通过登录的通知clcik发送演员 [英] Sending extras on clcik of notification via login

查看:149
本文介绍了通过登录的通知clcik发送演员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通知,并在它的点击,我需要去MainActivity页输入密码和登录,然后去ItemDetail活动page.But而发送通知我有一些额外的,我需要传递给ItemDetail活动页面,我将如何从点击发送到ItemActivity因为我有MainActivity之间?

 私人无效sendNotification时(弦乐味精,诠释invM_id,诠释prmR_id){        尝试{
        意图notificationIntent =新意图(这一点,ItemActivity.class);
        notificationIntent.setAction(Intent.ACTION_MAIN);
        notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        数据1 = WebService.InvoiceDetailForExeedDiscount1(invM_id);
*** //我需要ItemActvity这些数据,我可以在之间引入MainActivity前阅读本***
        notificationIntent.putExtra(invoiceList,DATA1);
        notificationIntent.putExtra(通知,是);
        notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        的PendingIntent contentIntent = PendingIntent.getActivity(这一点,NOTIFICATION_ID,notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT);        mNotificationManager =(NotificationManager)
               this.getSystemService(Context.NOTIFICATION_SERVICE);        NotificationCompat.Builder mBuilder =
                新NotificationCompat.Builder(本)
        .setSmallIcon(R.drawable.ic_launcher)
        .setContentTitle(的getString(R.string.invoice_alert))
        .setStyle(新NotificationCompat.BigTextStyle()
        .bigText(MSG))
        .setContentText(MSG);
            reminderStrings.append(prmR_id);
            reminderStrings.append(,);        mBuilder.setContentIntent(co​​ntentIntent);
        mNotificationManager.notify(NOTIFICATION_ID,mBuilder.build());
        NOTIFICATION_ID ++;        }


解决方案

您不能做一个双通。你必须做的两个步骤,例如也许传递的所有信息MainActivity,然后在MainActivity内,该表单检查后如果有这些信息,如果有,把它传递给ItemActivity

I have notification and on click of it ,i need to go to MainActivity Page to enter password and login and then go to ItemDetail Activity page.But while sending notification i have some extras which i need to pass to ItemDetail Activity page ,how will i send from on click to ItemActivity because i have MainActivity in between ?

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++;

        }

解决方案

You can't do a double pass. You'll have to do it in two steps, e.g pass all the information to MainActivity, then maybe inside the MainActivity, on completion of that form check if there's that info, and if there is, pass it to ItemActivity

这篇关于通过登录的通知clcik发送演员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆