Skip to content Skip to sidebar Skip to footer

Android - Parse Push Notification Crashes On Open

I have set up parse push notifications and I had my app crash when I tried to open it, now I found a work around my making a new java class and overriding onPushOpen like this: pub

Solution 1:

You are subclassing ParsePushBroadcastReceiver.

Then in manifest

<receiverandroid:name=".Receiver " // yourbroadcastreceiverandroid:exported="false" ><intent-filter>
            // youtr actions
        </intent-filter></receiver>

In BroadCastReceiver

publicclassReceiverextendsParseBroadcastReceiver {

@OverridepublicvoidonReceive(Context context, Intent intent) {

    super.onReceive(context, intent);

        extras = intent.getExtras();
        if(intent.hasExtra("com.parse.Data")) 
        {
            try
            {
             json = newJSONObject(intent.getExtras().getString("com.parse.Data"));
             int notificationtype = json.getInt("notificationtype"); // this is send on the sender sideswitch(notificationtype)
             {
              case1:

                    // show your custom notification. Refer android notification guide break;
                case2:
                //rest of the code

Note : If either "alert" or "title" are specified in the push, then a Notification is constructed using getNotification. So no alert and title on the sender side.

Read Managing Push Lifecycle @

https://www.parse.com/docs/push_guide#receiving/Android

Reference

https://www.parse.com/questions/how-suppress-push-notification-from-being-displayed

Post a Comment for "Android - Parse Push Notification Crashes On Open"