小编Eja*_*fat的帖子

Cordova Android推送通知与动作按钮

我使用了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") …
Run Code Online (Sandbox Code Playgroud)

android push-notification cordova

5
推荐指数
1
解决办法
1996
查看次数

标签 统计

android ×1

cordova ×1

push-notification ×1