Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7161107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:30:38+00:00 2026-05-28T13:30:38+00:00

I have a class extending android.os.Handler . An instance of this handler is passed

  • 0

I have a class extending android.os.Handler. An instance of this handler is passed to the constructor of a Messenger. The Messenger‘s IBinder from getBinder is passed as the result of onBind events in my service. Messages sent via the binder from remote applications do go to the handler’s handleMessage method, however calls to Binder.getCallingUid and Binder.getCallingPid within handleMessage always return the uid and pid of the service’s process (which is definitely not the same process as the remote application). handleMessage is definitely part of an IPC transaction, isn’t it? So where have I gone wrong? I need this to work for authentication of connecting applications.

Thanks in advance.

Edit

OK. I have this horrible feeling that handleMessage is not part of the IPC transaction, because that happens in separate threads for AIDL which puts messages in a queue for the Messenger. Is there any other way of getting the User ID and Process ID of the caller?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:30:39+00:00Added an answer on May 28, 2026 at 1:30 pm

    Make a custom Handler class and override sendMessageAtTime (this is the only overridable posting method in the Handler class ), and then use it to create a Messenger returned from onBind.

    In the sendMessageAtTime method, you can get the pid/uid of the calling remote application by getCallingPid and getCallingUid.

    But, in IPC using Messenger, as opposed to using AIDL, getCallingPid will always return 0 because the message sending by remote apps is asynchronous; transactions with IBinder.FLAG_ONEWAY.
    Therefore the uid is the only information available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've a question with regard to android adapters. I have a class, extending BaseAdapter.
I have a class extending PreferenceActivity: public class PreferenceActivity extends android.preference.PreferenceActivity { @Override protected
I'm trying to create a custom audio effect by extending from the class android.media.audiofx.AudioEffect
I have an intermediary class extending System.Web.UI.Page for all of my pages that require
Currently I have a class that is extending the ListActivity class. I need to
I have two classes in a PHP application, B extending A for example. Class
I have class A: public class ClassA<T> Class B derives from A: public class
Suppose I have class animal and classes cat and dog extending it. I want
I have a class generated from a WSDL that has a bunch of public
I have a taskBarIcon element extending Application Context from which my entire UI is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.