Solution 1 :
Check if the android:showOnLockScreen
, android:showWhenLocked
, and android:turnScreenOn
parameters are set to "true"
in your AndroidManifest.xml
?
Problem :
I want to open an activity when a push notification is received from FCM to my Android Oreo. But it’s not working. I have tried adding an HTTP call in onMessageReceived
method and that works as expected. But it will not start an activity, as in the code below:
@Override
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
//http call which succeeds
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
The manifest has this service definition:
<service
android_name=".services.CheckerService"
android_exported="false">
<intent-filter>
<action android_name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
Looking forward to some expert suggestions.
Comments
Comment posted by Jason
When your app is killed
Comment posted by Babu James
@Jason, the
Comment posted by Jason
did you check if your app is running after u swiped off from recents?
Comment posted by Babu James
@Jason, What I have done inside
Comment posted by famfamfam
@Jason im not agree with you, as you can see, skype, messenger can display directly calling screen when get a call, even app is closed or screen off