I want to open my application when I got a push notification. Now the application is not opening when the push received. Here is the code I am using,
Added WAKE_LOCK
Permission on manifest like,
<uses-permission android:name="android.permission.WAKE_LOCK" />
Here is my code to open the application,
Intent intent = new Intent(this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Constants.NewOrderRequest, true);
startActivity(intent);
use this to fire the activity from the service
Intent inte = new Intent(context, Activity.class);
inte.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
inte.addCategory(intent.CATEGORY_LAUNCHER);
context.startActivity(inte);
and in the activity place this in onCreate
Window window=this.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);