Start PendingIntent for result

I am implementing Activity X. I got PendingIntent Pfrom Service S. I know for sure that P points to an unknown Activity Y that returns the result of R through its method setResult.

How do I run P in X to get the result of R in X.onActivityResult?

+5
source share
2 answers

Google Play Services uses objects PendingIntentto resolve permission errors in the same scenario:

IntentSender intentSender = pendingIntent.getIntentSender();
activity.startIntentSenderForResult(intentSender, REQUEST_CODE, null, 0, 0, 0);

See Activity.startIntentSenderForResult () for documentation .

+5
source

, , Activities (X Y):

Activity X:

  • PendingIntent (P2), Activity X , X.createPendingResult. P2 X.onActivityResult.
  • PendingIntent P2 PendingIntent P send -.

Activity Y:

  • PendingIntent P2 getIntent().
  • setResult, .
  • onDestroy PendingIntent P2 .

?

, - . Activity Y ( Activity X). , setResult ? . .

-1

All Articles