我用过
Push Plugin,当我发送带按钮的按钮1)接受2)忽略.
通知来的时候,我点击了“接受”按钮.但我希望参数与“接受”按钮回调.从那我将识别与通知的“接受”被称为.
代码参考
//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(); }
代码“app.onPushAccept”函数是“接受”按钮的回调..
请尽快帮助我.
谢谢..
解决方法
Android推送通知(仅限)
第1步 – 首先转到下面的目录
plugins > phonegap-plugin-push > src > android > com > adobe > phonegap > push
第2步 – 从上面的目录中打开GCMIntentService.java文件
第3步 – 确定调用“createActions”的函数和
添加实际参数“requestCode”就像…
createActions(extras,mBuilder,resources,packageName,notId,requestCode);
第4步 – 确定函数定义“createActions”和
添加形式参数“int requestCode”就像…
private void createActions(Bundle extras,NotificationCompat.Builder mBuilder,Resources resources,String packageName,int notId,int requestCode)
第5步 – 在函数定义“createActions”中,在for循环中
将第二个参数从“i”更改为“requestCode”,如…
pIntent = PendingIntent.getActivity(this,requestCode,intent,PendingIntent.FLAG_UPDATE_CURRENT); pIntent = PendingIntent.getbroadcast(this,PendingIntent.FLAG_UPDATE_CURRENT);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。