我在我的应用程序中使用GCM,并且每当收到GCM消息时都使用NotificationManager创建通知.现在一切正常,GCM消息在通知区域正确显示,但是当我点击通知时它应该启动一个活动我的应用程序将显示未发生的消息详细信息.每次我点击通知它都不会启动任何活动,它仍然保持原样.我创建通知的代码是:
private void sendNotification(String msg) {
SharedPreferences prefs = getSharedPreferences(
DataAccessServer.PREFS_NAME, MODE_PRIVATE);
mNotificationManager = (NotificationManager) this
.getSystemService(Context.NOTIFICATION_SERVICE);
Intent intent = new Intent(this, WarningDetails.class);
Bundle bundle = new Bundle();
bundle.putString("warning", msg);
bundle.putInt("warningId", NOTIFICATION_ID);
intent.putExtras(bundle);
// The stack builder object will contain an artificial back stack for
// the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the …Run Code Online (Sandbox Code Playgroud)