通过登录发送通知clcik的附加内容

时间:2015-08-13 16:28:00

标签: android

我有通知,点击它,我需要去MainActivity页面输入密码和登录然后转到ItemDetail活动页面。但是在发送通知时我有一些额外的东西,我需要传递到ItemDetail活动页面,我将如何从点击发送到ItemActivity,因为我之间有MainActivity?

private void sendNotification(String msg, int invM_id, int prmR_id) {

        try {
        Intent notificationIntent = new Intent(this, ItemActivity.class);
        notificationIntent.setAction(Intent.ACTION_MAIN);
        notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        data1=WebService.InvoiceDetailForExeedDiscount1(invM_id);
***//I need these data in ItemActvity,i can read this before introducing MainActivity in between***
        notificationIntent.putExtra("invoiceList", data1);
        notificationIntent.putExtra("notified","yes");
        notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

        mNotificationManager = (NotificationManager)
               this.getSystemService(Context.NOTIFICATION_SERVICE);

        NotificationCompat.Builder mBuilder =
                new NotificationCompat.Builder(this)
        .setSmallIcon(R.drawable.ic_launcher)
        .setContentTitle(getString(R.string.invoice_alert))
        .setStyle(new NotificationCompat.BigTextStyle()
        .bigText(msg))
        .setContentText(msg);
            reminderStrings.append(prmR_id);
            reminderStrings.append(",");

        mBuilder.setContentIntent(contentIntent);
        mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
        NOTIFICATION_ID++;

        }

1 个答案:

答案 0 :(得分:0)

你不能做双通。您必须分两步完成,例如将所有信息传递给MainActivity,然后可能在MainActivity中,在完成该表单后检查是否有该信息,如果有,则将其传递给ItemActivity