parse custom receiver not getting called

Wednesday, July 2, 2014

I am trying to implement parse push notification in my android project. to understand, I am giving some project flow.

  • saving user details on personal server using php API

  • server send me some push notification.

I get notification but I am not getting any action, data in that push notification in my custom broadcast receiver.

Here is my Android Manifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />

android:protectionLevel="signature" />

<uses-permission android:name="com.mypackage.myapp.permission.C2D_MESSAGE" />
<uses-permission android:name="" />

android:theme="@style/AppTheme" >

<service android:name="com.parse.PushService" />
android:exported="false" android:enabled="true">
<action android:name="com.mypackage.myapp.MESSAGE" />

<category android:name="com.mypackage.myapp" />


Here is

public void onCreate() {

Parse.initialize(this, "xxxxxxxx", "xxxxxxxxxx");

ParseACL defaultACL = new ParseACL();

PushService.setDefaultPushCallback(getApplicationContext(), DashBoardActivity.class);


//String deviceToken= (String) installation.get("deviceToken");
//Toast.makeText(this, "Device token="+deviceToken, Toast.LENGTH_LONG).show();
PushService.subscribe(this, "Wake_up", DashBoardActivity.class);

And here is my custom receiver in which i am trying to get action and data which server sending me but my custom receiver not getting called.

String action = intent.getAction();
Log.d(TAG, "got action " + action );
if (action.equals("com.mypackage.myapp.MESSAGE"))
String channel = intent.getExtras().getString("com.parse.Channel");
JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data"));

Log.d(TAG, "got action " + action + " on channel " + channel + " with:");
Iterator itr = json.keys();
while (itr.hasNext()) {
String key = (String);
//if (key.equals("customdata"))
Intent pupInt = new Intent(context, ShowPopup.class);
pupInt.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
Log.d(TAG, "..." + key + " => " + json.getString(key));

} catch (JSONException e) {
Log.d(TAG, "JSONException: " + e.getMessage());

Even no any log getting printed. Here is php server code which sending me push notification.

$data = array(
'channel' => $chnl,
'action' => 'com.mypackage.myapp.MESSAGE',
'data' => array(
'alert' => $message,
'sound' => 'push.caf',
'photourl' => $imageurl,

But i don't understand where i need to get this data so i can show image after receiving push notification.

Please give me any hint or reference.