大佬教程收集整理的这篇文章主要介绍了Cordova Android推送通知与动作按钮,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
通知来的时候,我点击了“接受”按钮.但我希望参数与“接受”按钮回调.从那我将识别与通知的“接受”被称为.
//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 for 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(); }@H_618_26@代码“app.onPushAccept”函数是“接受”按钮的回调..
请尽快帮助我.
谢谢..
第1步 – 首先转到下面的目录
plugins > phonegap-plugin-push > src > android > com > adobe > phonegap > push@H_618_26@第2步 – 从上面的目录中打开GCMIntentservice.java文件
第3步 – 确定调用“createActions”的函数和
添加实际参数“requestCode”就像…
createActions(extras,mBuilder,resources,packagename,notId,requestCodE);@H_618_26@第4步 – 确定函数定义“createActions”和
添加形式参数“int requestCode”就像…
private void createActions(Bundle extras,NotificationCompat.builder mBuilder,resources resources,String packagename,int notId,int requestCodE)@H_618_26@第5步 – 在函数定义“createActions”中,在for循环中
将第二个参数从“i”更改为“requestCode”,如…
pIntent = PendingIntent.getActivity(this,requestCode,intent,PendingIntent.FLAG_updatE_CURRENT); pIntent = PendingIntent.getBroadcast(this,PendingIntent.FLAG_updatE_CURRENT);@H_618_26@
以上是大佬教程为你收集整理的Cordova Android推送通知与动作按钮全部内容,希望文章能够帮你解决Cordova Android推送通知与动作按钮所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。