简体   繁体   中英

Push notification with parse-push plugin & Ionic sent from parse dashboard but not received on Android device

I am using parse-push plugin with Ionic to send push notification to android devices. On the parse dashboard the notification is shown as sent but notification is not received on the device.

This is the parse-push plugin I use-

cordova plugin add https://github.com/grrrian/phonegap-parse-plugin --variable APP_ID=<appId> --variable CLIENT_KEY=<clientKey>

This is my code in app.js-

window.parsePlugin.initialize("<adppId>", "<clientKey>", function() {
    console.log('Parse initialized successfully.');

    window.parsePlugin.subscribe('DefaultChannel', function() {
      console.log('Successfully subscribed to DefaultChannel.');

      window.parsePlugin.getInstallationId(function(id) {
        // update the view to show that we have the install ID
        console.log('Retrieved install id: ' + id);

      }, function(e) {
        console.log('Failure to retrieve install id.');
      });

    }, function(e) {
      console.log('Failed trying to subscribe to DefaultChannel.');
    });

  }, function(e) {
    console.log('Failure to initialize Parse.');
  });

The device is registered as an installation object with the channel subscribed correctly as mentioned. Still the push-notification is not delivered.

Any one experienced this or knows how this can be solved?

Do you get an deviceToken registered in the Parse dashboard for this device?

I found bugs like this in some of the versions of phonegap-parse-plugin . Try a different fork like:

https://github.com/avivais/phonegap-parse-plugin or

https://github.com/bal200/phonegap-parse-plugin

Also, have you followed the Android Quirks section at the bottom of the Readme?

I was able to solve this by doing the following:

  1. Delete the ionic plugin for push-notification (I had added it to try the ionic-push service) & Delete the parse-push plugin too.

  2. Add the parse-push plugin again.

And this worked like a charm! I think the ionic-push plugin conflicts with the parse-push plugin I was using. Need to check their respective sources to figure out where exactly the conflict is but for now I have push notifications from parse working fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM