發表文章

目前顯示的是有「notification channel」標籤的文章

Android 8.0 Oreo 通知頻道Notification channels

圖片
這是在我們針對API 26(Oreo)的應用中更新我們的FCM內容的快速提示。 我不得不更新當前的應用程序(將targetSdkVersion更改為26)以支持Android Oreo(8.0)。一切都很好(在以前的版本中),但在 Oreo,這不是快樂的情況。通知未按預期工作:當設備收到推送通知時,應用程序崩潰。這是logcat中的例外: Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.google.firebase.iid.FirebaseInstanceIdInternalReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.firebase.INSTANCE_ID_EVENT pkg=PACKAGE cmp=COMPONENT }: app is in background uid UidRecord{c5e5e69 u0a325 RCVR bg:+1m25s411ms idle procs:1 seq(0,0,0)} at android.app.ActivityThread.handleReceiver(ActivityThread.java:3397) at android.app.ActivityThread.-wrap18(Unknown Source) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndAr