Android 2个通知,只有一个我可以打开,另一个没有启动我的活动

Android 2个通知,只有一个我可以打开,另一个没有启动我的活动,android,android-c2dm,Android,Android C2dm,我的问题是,当我发送多个通知(通过c2dm从服务器发送到手机)时,我会收到所有通知及其所有信息 我看到我有两个带有通知的图标。当我点击其中一个是我的信息(我点击了它,我得到了活动),另一个是不真实的。。。没有启动活动 我读了一些关于PendingEvent的文章,它只启动了一次活动,但我不知道该做什么 我需要得到每一个通知,而不仅仅是最后一个(这不像更新) 我向您提供了更多的信息,以了解如何调用此方法。请尝试:pendingent.getActivity(context,requestCode+

我的问题是,当我发送多个通知(通过c2dm从服务器发送到手机)时,我会收到所有通知及其所有信息

我看到我有两个带有通知的图标。当我点击其中一个是我的信息(我点击了它,我得到了活动),另一个是不真实的。。。没有启动活动

我读了一些关于PendingEvent的文章,它只启动了一次活动,但我不知道该做什么


我需要得到每一个通知,而不仅仅是最后一个(这不像更新)


我向您提供了更多的信息,以了解如何调用此方法。

请尝试:pendingent.getActivity(context,requestCode++,intent,0)

现在好多了,谢谢,但我收到两次相同的通知,我必须使用一些标志,比如更新当前…现在,每次我开始最后一次通知。我能做什么?你应该有相同的id通知,然后它会像一个更新…但我不想像更新。我要所有的通知。每次都有不同的id。我需要得到每一个通知,看到每一个,每一个开始活动。
private void incomingTestp(JSONObject json, Context context) throws JSONException {
    Intent intent = new Intent(context, TestpViewActivity.class);
    Testp testp = Testp.fromJSON(json);

    TestpServiceUtil.save(testp);
    intent.putExtra("testpId", testp.getTestpId());

    sendNotification("New Testp", "update", intent, testp.getTestpId(), context);
}

private void incomingTestr(JSONObject json, Context context) throws JSONException {
    Intent intent = new Intent(context, TestrViewActivity.class);
    Testr Testr = Testr.fromJSON(json);

    TestrServiceUtil.save(testr);
    intent.putExtra("testrId", testr.getTestrId());

    sendNotification("New Testr", "update", intent, report.getTestrId(), context);

}   

private void sendNotification(String title, String description, Intent intent, long id, Context context) {
    NotificationManager notificationManager = (NotificationManager) context.getSystemService(Service.NOTIFICATION_SERVICE);
    Notification notification = new Notification(R.drawable.icon, title, System.currentTimeMillis());
    intent.putExtra("force", true);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notification.setLatestEventInfo(context.getApplicationContext(), title, description, PendingIntent.getActivity(context, requestCode++, intent, Intent.FLAG_ACTIVITY_NEW_TASK));
    notification.vibrate = new long[] { 0, 200, 100 };
    //notification.defaults |= Notification.DEFAULT_SOUND;
    notificationManager.notify("Test", (int) id, notification);

}