fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
624 stars 998 forks source link

Crash when app in foreground #337

Open netwrkx opened 7 years ago

netwrkx commented 7 years ago

i'm having a same challenge push notification works in background but crashes without any log when the application is in foreground. plugins com-sarriaroman-photoviewer 1.1.10 "PhotoViewer" cordova-plugin-camera 2.3.1 "Camera" cordova-plugin-compat 1.1.0 "Compat" cordova-plugin-console 1.0.5 "Console" cordova-plugin-device 1.1.4 "Device" cordova-plugin-email 1.2.6 "EmailComposer" cordova-plugin-fcm 2.1.2 "FCMPlugin" cordova-plugin-file 4.3.3 "File" cordova-plugin-firebase 0.1.20 "Google Firebase Plugin" cordova-plugin-splashscreen 4.0.3 "Splashscreen" cordova-plugin-statusbar 2.2.1 "StatusBar" cordova-plugin-whitelist 1.3.1 "Whitelist" cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin" ionic-plugin-keyboard 2.2.1 "Keyboard"


            FCMPlugin.onNotification(
                (data) => {
                console.log("data", data);
                    if(data.wasTapped){
                        //Notification was received on device tray and tapped by the user.
                        //alert( JSON.stringify(data) );
                    }else{
                        //Notification was received in foreground. Maybe the user needs to be notified.
                        //alert( JSON.stringify(data) );
                    }
                },
                (msg) =>{
                    console.log('onNotification callback successfully registered: ' + msg);
                },
                (err) =>{
                    console.log('Error registering onNotification callback: ' + err);
                }
            );
firdousalam commented 7 years ago

i also faced same problem today.Please open your android studio and add/ update marshmallow in it. i was using noughat but once i install marshmallow my problem got solved so please try to update your android studio hope it will solve your problem