Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start PendingIntent for result

Tags:

android

I implement Activity X. I got a PendingIntent P from a Service S. I know for sure, that P points to unknown Activity Y which returns result R via its setResult method.

How should I start P in X, in order to receive the result R in X.onActivityResult?

like image 578
wrygiel Avatar asked Apr 28 '12 10:04

wrygiel


1 Answers

Google Play Services uses PendingIntent objects to 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.

like image 135
Rich Ehmer Avatar answered Sep 16 '22 21:09

Rich Ehmer