I am looking for a way to determine what application sent an Intent
. At present, I've registered a BroadcastReceiver
and have been trying to work with Binder.getCallingPid
, but it usually returns my app's PID. What I find weird is the usually part, my app does occasionally get the PID of the app that sent the Intent
, but it's not often and I cannot seem to pin down the conditions for which this is true.
Is there a way to accurately determine what app initiated a call to BroadcastReceiver.onReceive
?
@Override
public void onReceive(Context context, Intent intent) {
Log.d("Receiver", "Sender's PID: " + Binder.getCallingPid());
}