Reputation: 2649
I have an Android app running on S3 and motoX with a working receiver that can receive the push notification sent from Parse website.
However, the following case is not working:
Since the Android app can receive push notifications without any problems from Parse dashboard, I guess there must be something with my steps of sending the push notifications
Additional Description
When sending push notifications using parsePush.sendInBackground(SendCallback) method, it returns no ParseExceptions. So it means no error.
But the Parse Dashboard does not show this push notifications and the target does not get anything.
In the normal case, when a push notification is sent via Parse, it will show up as a push history in the Dashboard, but when I tried to send pushes from S3 to MotoX (or otherwise), it just not show anything in the Dashboard and the pushes are never get delivered.
Inside Application class:
ParsePush.subscribeInBackground("Giants");
Inside button click(Only Activity)
ParsePush push = new ParsePush();
push.setChannel("Giants");
push.setMessage("The Giants just scored! It's now 2-2 against the Mets.");
push.sendInBackground();
In Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pkg"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.pkg.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.pkg.permission.C2D_MESSAGE" />
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<application
android:name=".App"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.parse.APPLICATION_ID"
android:value="@string/parse_app_id" />
<meta-data
android:name="com.parse.CLIENT_KEY"
android:value="@string/parse_client_key" />
<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>
<receiver
android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false" >
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver
android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.pkg" />
</intent-filter>
</receiver>'
In Push settings screen of
Is there any other additional step, am I missing or mistake in code?
UPDATE: I had tested in the corporate network,is there any possibility that firewall blocks but push from Parse works seamlessly
Upvotes: 0
Views: 630
Reputation: 11
After a lot of frustration I found the solution. It seems that the method setChannel()
causes the problem. If you replace it with a query based push like so:
// Create our Installation query
ParseQuery pushQuery = ParseInstallation.getQuery();
pushQuery.whereEqualTo("channels", "Giants");
and then:
ParsePush push = new ParsePush();
push.setQuery(pushQuery);
push.setMessage("The Giants just scored! It's now 2-2 against the Mets.");
push.sendInBackground();
that should do the trick.
Upvotes: 1