アクションの実行が終了したときに何をすべきかをサービスに指示したいと考えています。だから私はサービスを送信したいPendingIntentので、サービスを開始できます(を使用してPendingIntent.send())
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);
ここで、 を にどのように取り付け始めるかという問題がpendingIntentあります。pendingIntent
たとえば、これを試しました:
NewIntent.putExtra("pendingIntent",pendingIntent);
startService(NewIntent);
しかし、うまくいきません。
そしてサービスで:
PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra("pendingIntent");
pendingIntent.send();