简体   繁体   中英

Android Push Notification - How to get notification data when you click on action button of individual push notification

Plugin Used - Cordova Push Plugin

There are two button "Accept" and "Ignore" When i am sending push

I want to identify which notification is clicked and

I want to get notification data When App comes in foreground mode By click on Action of individual notification

在此输入图像描述

1) Open File GCMIntentService.java from given below directory

plugins\\phonegap-plugin-push\\src\\android\\com\\adobe\\phonegap\\push

2) Replace line from Old To New
Old : createActions(extras, mBuilder, resources, packageName, notId);

New : createActions(extras, mBuilder, resources, packageName, notId,requestCode);

3) Replace line from Old To New
Old : private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName, int notId)

New : private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName, int notId,int requestCode)

4) Replace line from Old To New
Old : pIntent = PendingIntent.getActivity(this, i, intent, PendingIntent.FLAG_UPDATE_CURRENT);

New : pIntent = PendingIntent.getActivity(this, requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);

5) Replace line from Old To New
Old : pIntent = PendingIntent.getBroadcast(this, i, intent, PendingIntent.FLAG_UPDATE_CURRENT);

New : pIntent = PendingIntent.getBroadcast(this, requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM