0

I am trying to start a new activity when a particular type of push notification is tapped. I've extended ParsePushBroadcastReceiver class (I'm using Parse) and overridden onPushOpen method.

When I tap on the push, the following code does get called:

Intent postIntent = new Intent(App.context, SinglePostActivity.class);
postIntent.putExtra(SinglePostActivity.ARG_POST_ID, postId);
context.startActivity(postIntent);

But nothing happens. I have my activity registered successfully in AndroidManifest. How can I start the activity successfully?

Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389

1 Answers1

1

Probably App.context causing issue.

Use Context parameter of onPushOpen method for creating Intent and accessing startActivity Activity method :

Intent postIntent = new Intent(context, SinglePostActivity.class);
....
postIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(postIntent);
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213