0
,當我在我的應用程序的時候,我點擊我的應用程序的通知打開另一個我的應用程序,則對第二個屏幕相同的應用程序和BTW我是來自意圖服務創建通知當我點擊通知開我的另一個應用程序
private void sendNotification(String msg, int msgdifferent) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("......")
.setContentText(msg).setContentInfo(msgdifferent + "");
Intent resultIntent = new Intent(this, MainActivity.class);
resultIntent.putExtra("Update", "YES");
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(MainActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
好非常感謝你:) – massaimara98 2014-09-25 18:17:59
如果這是正確的答案,請記住這答案接受 – santalu 2014-09-25 18:20:37
當然,對不起:( – massaimara98 2014-09-25 18:22:50