Cordova Android Push Notification With Action Button -


i have used push plugin , when sending push action button 1)accept 2)ignore.

when notification came , clicked on "accept" button . want parameters "accept" button callback. identify notification's "accept" called.

code reference

//initialization of push object         var push = pushnotification.init({             "android": {                 "alert": "true",                 "senderid": config.project_number,                 "icon": "img/ionic.png",                 "iconcolor": "blue",                 "badge": "true"             },             "ios": {                 "alert": "true",                 "badge": "true",                 "sound": "true"             },              "windows": {              }          });          //listner getting registration detail of device         push.on('registration', function(data) {             device_id_for_push=data.registrationid;         });          //listner called on new push notification         push.on('notification', function(data) {             // app.onpushaccept(data);             alert("on notification");             alert(json.stringify(data));         });          //error listner         push.on('error', function(e) {             // alert(e);             // alert("push error");         });          app.onpushaccept=function(data){             alert("onpushaccept")             alert(json.stringify(data));             // cordova.plugins.notification.badge.clear();             // cordova.plugins.notification.badge.increase();         } 

in code "app.onpushaccept" function callback of "accept" button..

please me possible. thank you..

android push notification (only)

step 1 - first of go given below directory

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

step 2 - open gcmintentservice.java file above directory

step 3 - determine function calling "createactions" , add actual parameter "requestcode" like...

     createactions(extras,mbuilder,resources,packagename,notid,requestcode); 

step 4 - determine function definition "createactions" , add formal parameter "int requestcode" like...

     private void createactions(bundle extras, notificationcompat.builder mbuilder, resources resources, string packagename, int notid,int requestcode) 

step 5 - in function definition "createactions" , inside loops change second parameter "i" "requestcode" like...

     pintent = pendingintent.getactivity(this, requestcode, intent, pendingintent.flag_update_current);       pintent = pendingintent.getbroadcast(this, requestcode, intent, pendingintent.flag_update_current); 

step 6 - after completing above steps remove android platform if added platform add android platform.

sorry , improve if mistake founds in solution.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -