GCM プッシュ通知メッセージを取得した後、通知を作成しています。これで完了です。しかし、通知をクリックすると、起動しないことがあります(PendingIntent)。ほとんどの問題は、通知を受け取った直後にクリックすると発生します。保留中の意図は、実際には私の最初のログイン ページそのものです。これがソースコードです..
public void createNotification(Context context, String message) {
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon,
"My notification", System.currentTimeMillis());
// Hide the notification after its selected
notification.flags |= Notification.FLAG_AUTO_CANCEL ;
Intent intent;
intent = new Intent(context, Login.class);
intent.putExtra("pushNoti", "pushNoti");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(context, "my Alert",
message, pendingIntent);
notification.defaults = Notification.DEFAULT_SOUND;
notificationManager.notify(0, notification);
}
ここで、コンテキストは GCM onMessage(コンテキスト コンテキスト、インテント インテント) から取得されます。
誰でも私を助けることができますか?