Published 24 Oct, 2022

Java - Notification FCM android java doesnt work Service took too long to process intent: com.google.android.c2dm.intent.RECEIVE App may get closed

Category Java
Modified : Nov 29, 2022
11

I have a problem with firebase cloud messaging. I use the topic method to send a notification to android devices. It was working fine at the beginning, but after I tried several times, my android didn't receive any notification. Here the response from logcat.

Service took too long to process intent: com.google.android.c2dm.intent.RECEIVE App may get closed. Service took too long to process intent: com.google.firebase.messaging.NEW_TOKEN App may get closed. Background concurrent copying GC freed 253407(16MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 20MB/40MB, paused 99us total 119.008ms Background concurrent copying GC freed 268107(18MB) AllocSpace objects, 0(0B) LOS objects, 50% free, 22MB/44MB, paused 133us total 185.233ms Background concurrent copying GC freed 302407(20MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 24MB/48MB, paused 1.088ms total 125.508ms Background concurrent copying GC freed 328828(21MB) AllocSpace objects, 0(0B) LOS objects, 47% free, 26MB/50MB, paused 186us total 118.766ms Background concurrent copying GC freed 318573(21MB) AllocSpace objects, 0(0B) LOS objects, 45% free, 28MB/52MB, paused 1.163ms total 120.955ms Background concurrent copying GC freed 328906(21MB) AllocSpace objects, 0(0B) LOS objects, 43% free, 31MB/55MB,

and this is my notification:

{
    "to" : "/topics/new_articles",
    "data" : {
        "title" : "New Article: Menang atas perasaan hari esok updated!!", 
        "body" : "Artikel terbaru, baru saja di update, cek sekarang!",
        "topic": "/topics/new_article",
        "article_id" : "6"
    }
}

please help me..

Answers

There are 1 suggested solutions here and each one has been listed below with a detailed description. The following topics have been covered briefly such as Firebase, Java, Android, Firebase Cloud Messaging. These have been categorized in sections for a clear and precise explanation.

31

Work that takes more than 10 seconds is blocked by the Android core Foreground service should be used to fix the problem

this link can help

Services overview