phonegap-parse-plugin
phonegap-parse-plugin copied to clipboard
`broadcast intent callback: result=CANCELLED` error
I have spent the last few days trying to get notifications working, reading up on all sorts of plugins and I've come to the end of my rope. I've been able to successfully receive notifications with Parse's test apps on Android and iOS, but whenever I try to add to my own app I see an error in adb logcat
cordova version: 3.5.0-0.2.4
These are the steps I perform:
cordova create pushTest
cordova platform add android
cordova plugin add https://github.com/benjie/phonegap-parse-plugin
then inside of www/js/index.js I alter the onDeviceReady function to look like this (with my actual appID and clientKey substituted)
onDeviceReady: function() {
app.receivedEvent('deviceready');
parsePlugin.initialize(appId, clientKey, function() {
parsePlugin.subscribe('', function() {
alert('OK');
}, function(e) {
alert('error');
});
}, function(e) {
alert('error');
});
}
Then I clear out my Installation class in Parse to make sure the app registers successfully. I also make sure any previous app I've installed to my android device has been deleted. Then...
cordova build
adb install platforms/android/ant-build/HelloCordova-debug.apk
I get an alert popup that says 'OK' and I have a new record in the Installation class in Parse. I make sure the app is not running in the foreground on my android device. I then send a push notification from Parse, and I don't see anything while running adb logcat
From some other debugging I had tried, I tried replacing the version of the Parse SDK from 1.3.8 to 1.5.1 by just removing the old file from the platforms/android/libs dir and putting the new one there. Once I do that, I see the below error in adb logcat
( 2795): GCM message io.cordova.hellocordova 0:1402793727153630%0#39597f64f9fd7ecd
W/GCM-DMM ( 2795): broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=io.cordova.hellocordova (has extras) }
That error is what I've been stuck at, and would love guidance with.
Hey,
I'm in pretty much the same boat as you are. When you said that you were able to receive notifications with Parse's test apps on Android and iOS, which test apps were you referring to? I'd like to try them out myself.
I've been bashing my head on this stuff since Friday and I've gotten pretty familiar with things, but I haven't yet got my own app working either. I suspect that the newer versions of phonegap are causing this issue, but I'm not entirely certain of that yet.
If you figure out what's wrong yourself, please share your findings! :) I'll be sure to do the same if I can get one working.
The Parse tutorials I followed are: Android: https://parse.com/tutorials/android-push-notifications iOS: https://parse.com/tutorials/ios-push-notifications
I was hoping to glean something by having working versions of those, but it didn't help. I've posted this same inquiry on stackoverflow, so keep an eye on that too. (http://stackoverflow.com/questions/24225735/how-do-i-receive-notifications-with-parse-phonegap-and-the-phonegap-parse-plugi)
Someone on StackOverflow suggested this plugin instead: https://github.com/hazemhagrass/push-parse
But it needs a MainActivity.java which is missing when doing cordova create. The Parse.com tutorial app has a MainActivity class that gets registered and I've hacked something together that actually shows notifications from it although I am still trying to debug it. Will share if it ends up working.
I used this version of the Plugin: https://github.com/benjie/phonegap-parse-plugin It has some extra configuration options for Android that I needed