Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix: android.app.RemoteServiceException without any message (not related to Bad Notification or Broadcast)

I have an android.app.RemoteServiceException (RSE) but without any message. I get the following crash report on Google Play Console. When I get a RSE due to a bad Notification or Broadcast I get the related message but in this case it is a black crash.

android.app.RemoteServiceException: 
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1813)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6781)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)

I started getting these crashes primarily on Android 7 and Samsung devices (in large).

Android versions and devices

We are following standard guidelines for Notifications and Broadcasts.

targetSdkVersion 25
compileSdkVersion 26

I have gone through many StackOverflow questions related to RemoteServiceException but not been able to find RCA hence posting the new question.
Listed below are the questions I have checked and not been able to find a resolution for RSE:

  • How to fix: android.app.RemoteServiceException: Bad notification posted from package *: Couldn't create icon: StatusBarIcon
  • How to add vertical line to RemoteView for custom Android Notifications?
  • How to fix this bug : "android.app.RemoteServiceException: Bad notification posted from package"
  • FCM - How to fix android.app.RemoteServiceException: Bad notification posted from package Couldn't expand RemoteViews for: StatusBarNotification
  • Android - getting "can't deliver broadcast" error on dynamically registered broadcast receiver
  • Fatal Exception: android.app.RemoteServiceException: can't deliver broadcast at android.os.Handler.dispatchMessage
like image 884
Nikhil Joshi Avatar asked Feb 15 '18 10:02

Nikhil Joshi


1 Answers

if you have started service using startforgroundservice()

then you have to call startforground() in service oncreate by following the google instructions for oreo.

like image 172
Waqas Yousaf Avatar answered Oct 20 '22 21:10

Waqas Yousaf