Je veux dire à mon service quoi faire quand il a fini d'effectuer une action. Je veux envoyer le service un PendingIntent
, il peut commencer (en utilisant PendingIntent.send()
)Comment envoyer PendingIntent à mon service à l'intérieur Intent
PendingIntent pendingIntent;
Intent newInt;
newInt = new Intent(Intent.ACTION_SENDTO);
newInt.setData(Uri.parse("sms:052373"));
newInt.putExtra("sms_body", "The SMS text");
pendingIntent = PendingIntent.getActivity(this, 0, newInt, 0);
Maintenant, la question de savoir comment commencer à fixer le pendingIntent
au pendingIntent
?
J'ai essayé par exemple:
NewIntent.putExtra("pendingIntent",pendingIntent);
startService(NewIntent);
Mais il ne fonctionne pas.
Et dans le service:
PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra("pendingIntent");
pendingIntent.send();
"Mais il est ne fonctionne pas" est une description inutile de vos symptômes. – CommonsWare
Merci, la prochaine fois je serai plus précis – Aminadav