【发布时间】:2014-11-19 18:04:24
【问题描述】:
我的应用程序包含多个活动。我已经实现了推送通知,并且还在栏中显示了通知。我的问题是,当我单击通知时,会将我带到我指定的特定活动。
Intent intent =new Intent(GcmService.this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(GcmService.this, 0, intent, 0);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(
getApplicationContext())
.setContentTitle(getResources().getString(R.string.app_name))
.setAutoCancel(true)
.setContentIntent(pendingIntent);
notificationBuilder.setContentIntent(pendingIntent);
mNotificationManager.notify((int) when, notificationBuilder.build());
如果我的活动在后台,我想要,并且用户点击通知应用程序恢复当前在后台的活动并显示对话框。 如果我的申请已关闭。打开 Launching 活动,然后显示对话框。
【问题讨论】: