Exception When Opening Parse Push Notification

Exception when opening Parse push notification

After spending few hours. Found a solution:
Implement your receiver and extends ParsePushBroadcastReceiver class.

Receiver.java

public class Receiver extends ParsePushBroadcastReceiver {

@Override
public void onPushOpen(Context context, Intent intent) {
Log.e("Push", "Clicked");
Intent i = new Intent(context, HomeActivity.class);
i.putExtras(intent.getExtras());
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}

Use it in manifest, (Instead of using ParsePushBroadcastReceiver)

Code for project's manifest:

<receiver
android:name="your.package.name.Receiver"
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>

Happy Coding!!

Parse Push Notification Exception: unauthorized: master key is required

UPDATED ANSWER

Hi, i investigate it a bit and found that currently the only to send Push is by using the masterKey and that's exactly the reason why you are getting this error

In order to send push with master key the best approach will be to create a cloud code function and trigger this function from the client side.
so you need to do the following:

  1. Inside your cloud code main.js file create a new function

Parse.Cloud.afterSave("SendPush", function(request) {

var query = new Parse.Query(Parse.Installation); query.exists("deviceToken");
// here you can add other conditions e.g. to send a push to sepcific users or channel etc.
var payload = { alert: "YOUR_MESSAGE" // you can add other stuff here... };

Parse.Push.send({ data: payload, where: query }, { useMasterKey: true }) .then(function() { response.success("Push Sent!"); }, function(error) { response.error("Error while trying to send push " + error.message); });});

Parse Push No Activity Found on opening Push Notification

Quoting from below post by Ahmad Raza
Exception when opening Parse push notification

You can extend ParsePushBroadcastReceiver and override onPushOpen method.

public class Receiver extends ParsePushBroadcastReceiver {

@Override
public void onPushOpen(Context context, Intent intent) {
Log.e("Push", "Clicked");
Intent i = new Intent(context, HomeActivity.class);
i.putExtras(intent.getExtras());
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}

Use it in manifest, (Instead of using ParsePushBroadcastReceiver)

<receiver
android:name="your.package.name.Receiver"
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>

App crashes on parse push notification when the app is not running

Do the parse initialisation in Application onCreate and make sure you are calling it in the mainThread.

Parse.initialize(new Parse.Configuration.Builder(getApplicationContext()).applicationId(
...).build());

Error ~ parse.com push notification android?

1) You should check your Eclipse project's libs folder. Possibly you are missing the latest bolts jar file. This is part and parcel of the zip that contains the parse lib files.

2) Unfortunately, the official tutorials are somewhat misleading because they are not fully updated with the latest changes of the API. Actually this was necessary until Parse version 1.6, if I am not mistaken.

Now, as you can see in your custom receiver's code, you set the activity that is going to open when clicking the notification by setting a pending intent. Check this note of deprecation.
The current implementation, using the new ParsePushBroadcastReceiver, is more flexible than ever! So instead of extending the BroadcastReceiver, extend this one. Be sure to read the documentation about this. It is very helpful.


Also:

a) In your manifest replace the portion of the "My custom receiver" with the following

<receiver android:name=".ParseReceiver" android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.OPEN" />
<action android:name="com.parse.push.intent.DELETE" />
</intent-filter>
</receiver>


b) Change this

<receiver android:name="com.parse.ParseBroadcastReceiver" >

to your own custom receiver

<receiver android:name="com.makemyandroidapp.parsenotificationexample.ParseReceiver">



c) In your manifest make sure to use the ParseApplication class you have created as the name attribute:

<application
android:name=".ParseApplication"
....
....
/>




I hope the above will help you continue with your project.

Not receiving Parse Push Notifications In Android

Generally, I recommend the official tutorial.

  1. Your com.parse.ParseBroadcastReceiver uses wrong action names and should read:

    <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>
  2. You're lacking this receiver (code from the tutorial linked above):

    <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" />

    <!--
    IMPORTANT: Change "com.parse.tutorials.pushnotifications" to match your app's package name.
    -->
    <category android:name="com.parse.tutorials.pushnotifications" />
    </intent-filter>
    </receiver>
  3. You have to enable push notifications by subscribing to a channel, e.g., via:

    ParsePush.subscribeInBackground("", new SaveCallback() {
    @Override
    public void done(ParseException e) {}
    });


Related Topics



Leave a reply



Submit