FirebaseMessagingService is not working in background using one plus 3 android oreo 8.0

Firebase onMessageReceived never called when app is not running and removed from recent apps list. I'm working with Firebase and sending data payload notifications to my app from my server, i have tried to use JobScheduler to start MyFirebaseMessagingService every 1 minute in case the system is killing my service but this approach didn't work for me on One Plus 3. I know that android add limitation on background services to optimize battery usage, but does this limitation affect on FCM service?

here is my message string:

"notification": {
    "title": "Hello",
    "body": "Notification",
    "badge": 1,
    "icon": "app_icon",
    "color": "#ffffff",
    "sound": "default",
    "clickAction": "home",
    "tag": "parent_ccid_6"
"message": {
    "priority": "high",
    "type": "daily_tips",
    "data": {
        "parent_ccid": "parent_ccid_6",
        "id": "2",
        "sound": "default"


and here is my Service in manifest

            <action android:name="" />
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="" />

You must use Notification Channel for above Nougat


        int notifyID = 1;
        String CHANNEL_ID = "my_channel_01";
         // The id of the channel.
        CharSequence name = "channel ram";
         // The user-visible name of the channel.
        String groupId = "Building654651";
        CharSequence groupName = "BuilgingHub123";
        int importance = 0;
            importance = NotificationManager.IMPORTANCE_HIGH;
            NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, importance);
 Notification notification = new Notification.Builder(this)
  NotificationManager mNotificationManager =
                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.createNotificationChannelGroup(new NotificationChannelGroup(groupId, groupName));
            mNotificationManager.notify(notifyID, notification);

onMessageRecieved not working when app is killed. � Issue #368 , It works perfect in foreground and in background and I can receive Extras in MainActivity. I also have oneplus 3 mobile and i was having same issues ,but after adding how to handle notification when app in kill in firebase android I am using Samsung J5 with this push notification problem when app is� One of those common issues is that the applications doesn’t get push notifications. There are multiple reasons such as Unregistered device token or app is killed or Android Oreo’s doze mode is on etc. We will talk about here for one reason of app being in background and foreground and see how it can be solved.

When the application is in background onMessageReceived will never be called as per the android document. Link:-

When app is in background the notification is delivered to the device’s system tray and default intent of your application (i.e Launcher Screen) will be called and you have to handle that notifcation on this screen.

Other solution is that you can remove the "notification" keyword from payload then you will able to receive the notification when your application is in background and onMessageReceived will get called.

No notification, I am able to get notification in foreground and background. these problem comes with Android Oreo, the battery optimization become very� Notification is not working as a background service in One plus 3/3T. In situation one, Oreo, the latest version of Android, supports some methods and classes which are not used by the legacy code

I didn't find any solution to solve this issue by code. The only way to revive notification is to go to settings and select "Don't optimize" from Battery optimization settings, and it works fine in background, otherwise notification handler will not be triggered. I faced this issue with all installed applications on One plus 3.

fcm push notification not working in one plus 6 mobile, oreo push notifications not working But in case of oneplus, fcm notification is not working when an app is closed by swiping from a tray, but work properly when an app is in foreground and background. am an Android developer, I am using FirebaseMessagingService to the push notifications, Wait about 5-6 minutes 3. Scheduling jobs. So to begin with, using a Job Scheduler allows us to move away from our background service implementation and let the system take care of the execution for us. The system will

Try android:exported="true". in your android manifest file.

FirebaseMessagingService无法在使用一加3 Android Oreo 8.0的 , FirebaseMessagingService无法在使用一加3 Android Oreo 8.0的后台运行 FirebaseMessagingService is not working in background using one plus 3 android oreo 以防系统杀死我的服务,但这种方法在One Plus上不起作用3. To migrate to Android 8.0 (API level 26), the developer replaces the background service with a scheduled job, which is launched periodically, queries the server, then quits. Prior to Android 8.0, the usual way to create a foreground service was to create a background service, then promote that service to the foreground.

Android FCM not receiving notifications when app is removed from , App receives notification when the app is in foreground on in background but in the memory. it will not work on some devices, when an app is in the background. using FirebaseMessagingService will not call.notification will be shown even app is Update: OnePlus 3 and Android 8.0 the Auto-start option was removed,� android:label="@string/app_name" tools:node="replace" tools:replace="android:icon,android:label" If I remember correctly, the above lines were used to override the appearance of the incoming push messages etc. This was originally implemented by a previous developer on my project and it was a coincidence that I discovered this.

FirebaseMessagingService onReceivedMessage(RemteMessage , onMessageReceived() method will not be called if the app is in background or killed only Fcm notification not received when app is closed android oreo Android device: One Plus 11.7.46 Firebase/Play Services SDK version: 11.6.0 Step 3: from recents apps) I'm having a problem with push notifications on firebase. Last week, I had to update the current app (changing the targetSdkVersionto 26) to support Android Oreo (8.0). Everything works great (in previous versions) but in Oreo that was not the happy case.

Android Push Notifications using Google Cloud Messaging (GCM , Android Push Notifications using Firebase Cloud Messaging FCM & When in the background – Apps receive the notification payload in the To overcome this problem you need to integrate the firebase API 3. Create a file named push. php This class prepares and the push plus i have this error also! After that, various OS behaviors such as Android O's background execution limits may interfere with your ability to complete your work. For more information see our overview on message priority. Edit the app manifest. To use FirebaseMessagingService, you need to add the following in your app manifest:

  • Thank you M.Ram, I have already implement Channels for android > N, and it works fine when application in foreground or in recent apps list, but when close the app on onMessageReceived is never triggered.
  • Thank you Kishna, I have tried this solution using and set Post body as: { "to" : "ewHHsQa3R6g:APA91bF....", "priority": "high", "android_channel_id":"DEFAULT_CHANNEL", "data": { "type": "daily_tips", "daily_tips_type": "interest", "parent_ccid": "parent_ccid_6", "ccid": "ccid_6", "id": "2", "cid":1, "sound": "default" } } but it didn't work too.
  • Can you post your server notification code and android code
  • I don't have access to server code but the message data will come as the posted question above, and it works fine with other devices even though they have android 8 and 8.1, except my one plus and Huawei. and if i go to settings and select "Don't optimize" from Battery optimization settings it works fine in background
  • Could you please expand upon your answer with a little more detail. Adding context to your answers make them more valuable.
  • Note that there is already an accepted answer to this question. Please edit your answer to ensure that it improves upon other answers already present in this question.