Usually you should add it to the class that extends the ParsePushBroadcastReceiver e.g.
public class YourBroadcastReceiver extends ParsePushBroadcastReceiver {
....
protected Activity getActivity(Context context, Intent intent) {
return yourActivity; // the activity that shows up
}
....
}
Implement your receiver and extends ParsePushBroadcastReceiver class.
public class Receiver extends ParsePushBroadcastReceiver {
@Override
public void onPushOpen(Context context, Intent intent) {
//To track "App Opens"
ParseAnalytics.trackAppOpenedInBackground(intent);
//Here is data you sent
Log.i(tag, intent.getExtras().getString( "com.parse.Data" ));
Intent i = new Intent(context, HomeActivity.class);
i.putExtras(intent.getExtras());
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
Then, in your AndroidManifest.xml, (Instead of using ParsePushBroadcastReceiver)
Write your on Receiver extends ParsePushBroadcastReceiver and your activity with the help of below code.
Note: Your activity must be a launcher activity.
Usually you should add it to the class that extends the ParsePushBroadcastReceiver e.g.
If you followed the documentation for an existing project like me, this is deprecated:
PushService.setDefaultPushCallback(this, YourActivity.class);
This works to me:
Implement your receiver and extends ParsePushBroadcastReceiver class.
Then, in your AndroidManifest.xml, (Instead of using ParsePushBroadcastReceiver)