You may go through following steps:
- Start a Foreground Service (that always run in background )
- In Your Service Class catch Your Event(like you said fcm notification) and start your app activity.( Rather you should alert user with alarm tone or on-screen Dialog
Here's an wonderful example that uses a background service(you may change it into a foreground service) to show a fragment on lockscreen hope this will help you know how and where to start.
and also it's not a bad behavior cause the notification panel will always show that your foreground service is running untill and unless user himself turn notifications off your app
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…