Reputation: 83
I am making an app that will use the Parse.com Push notifications, however it is not working like the guide shows.
The issue is, i have set up the Parse push activity fine, registered the new installation, and am able to see which channels a user is subscribed to. I am able to receive the Push notification from parse, but unable to send from my app.
There are no errors following in logcat, and parse records that a push was sent, but shows that there are "no subscribers" to the channel.
In my onCreate:
Parse.initialize(MainActivity.this, "***", "***");
PushService.setDefaultPushCallback(this, MainActivity.class);
PushService.subscribe(this, "Everyone", MainActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
The Push code:
ParsePush push = new ParsePush();
push.setChannel("Everyone");
push.setMessage("Hey!");
push.sendInBackground();
The manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application>
....
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
</application>
There are no errors in logcat, everything seems to be sent smoothly, but in parse i get the following messages:
My Push
You sent this push notification to 0 recipients.
Targeting : channels includes "Everyone"
Sending date : November 28th, 2013 at 9:40 AM
Expiration : None
Full target : { "channels": { "$in": [ "Everyone" ] } }
Full data : {"alert"=>"Hey!"}
The only changes i can see from the push that i send vs the Push that parse.com sends is the "Full data" field
Parse Push
Targeting : channels includes "Everyone"
deviceType is "android"
Sending date : November 28th, 2013 at 9:21 AM
Expiration : None
Full target : { "channels": { "$in": [ "Everyone" ] }, "deviceType": "android" }
**Full data : { "alert": "hi" }**
Thanks in advance for any help / ideas
Upvotes: 8
Views: 8170
Reputation: 885
Just You uninstall your application from emulator and you verify that the name of your package in gradle
make shore that the applicationId "Your Package" is the same in Android manifest
Upvotes: 0
Reputation: 5473
In my case, I defined a packageName
in the AndroidManifest.xml
different of the build.gradle
... it took 3 hours to realize the error. Maybe it could help :)
Upvotes: 1
Reputation: 373
You should turn on push notification from parse setting on the website parse.com
App -> Settings -> Push Notifications -> Client push enabled (should be on)
Upvotes: 20