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
Turn on notifications for Android devicesTap More on the bottom navigation bar and select Settings. Tap Turn on notifications. Tap Notifications. Tap Show notifications.
Push notifications, when implemented properly, are resistant to interception or redirection and are, therefore, more secure than SMS.
You should turn on push notification from parse setting on the website parse.com
App -> Settings -> Push Notifications -> Client push enabled (should be on)
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 :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With