Both are possible. The source code to the Firebase push messaging service is available on Maven and GitHub, so you can re-implement it. Otherwise, you subclass the same service but override `onHandleIntent` instead of `onMessageReceived`, and avoid the code path that immediately displays the notification for 'notification' messages when the app is in the background.