Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

App with phonegap-plugin-push 2.0.0 android crashes when a message is sent #2360

@bhatnagaranilb

Description

@bhatnagaranilb

Expected Behaviour

  • App should not crash when app is open and a notification is sent.
  • Tray should show notification when app is in background and a notification is sent.

Actual Behaviour

  • App crashes (Unfortunately this app has stopped working) when app is open and a notification is sent.
  • Tray does not show notification when app is in background and a notification is sent.

Reproduce Scenario (including but not limited to)

As listed above

Steps to Reproduce

As listed above

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 5.1

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Micromax Q412

Cordova CLI version and cordova platform version

Phonegap CLI 7.0.1, Android 6.2.3

Plugin version

2.0.0

Sample Push Data Payload

'data'=> {
'title' => "Hello World",
'body' => "Did you practice today?"
}

Sample Code that illustrates the problem

config.xml is---

<platform name="android">
    <resource-file src="google-services.json" target="/google-services.json" />
</platform>

<plugin name="cordova-plugin-device" spec="2.0.2" source="npm" />   
<plugin name="phonegap-plugin-push" spec="2.0.0" source="npm">
    <variable name="SENDER_ID" value="1:XXXXXXXX:android:YYYYYYY" />
</plugin>

Javascript code has:

function onDeviceReady() 
{
    registerForFCMPushNotifications();
    //... more code
}

function registerForFCMPushNotifications()
{
    var notificationObj = PushNotification.init({
        android: {
            senderID: "XXXXXXXXX",
            badge: "true",
            sound: "true",
            vibrate: "true",
            topics: ["all"],
            forceShow: "false"
        },
        ios: {
        },
        windows: {}
    });

    notificationObj.on('registration', function(data) {alert('Id='+data.registrationId);});
    notificationObj.on('notification', function(data) {alert("Got notification");});
    notificationObj.on('error', function(e) {alert( e.message );});
}

Logs taken while reproducing problem

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions