Feature #6260

verify Intent sender when receiver is Service and/or BroadcastReceiver

Added by hans about 2 years ago. Updated about 2 years ago.

Status:NewStart date:11/13/2015
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


With an Activity, this is done by using getCallingActivity() and the sender has to send using startActivityWithResult(). There is nothing like that for Services and BroadcastReceivers, but other techniques show promise:


#1 Updated by hans about 2 years ago

This should really be implemented in TrustedIntents first. Here is a quick sketch, but nothing working yet:

Intent verifyIntent = new Intent(PanicUtils.ACTION_VERIFY);
int flags = PendingIntent.FLAG_ONE_SHOT;
if (Build.VERSION.SDK_INT >= 23) {
    flags |= PendingIntent.FLAG_IMMUTABLE;
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, verifyIntent, flags);
IntentSender intentSender = pendingIntent.getIntentSender();
Parcel out;
PendingIntent.writePendingIntentOrNullToParcel(pendingIntent, out);

Also available in: Atom PDF