robospice
robospice copied to clipboard
RuntimeException: icon must be non-zero
I am seeing this exception being reported in Crashalytics. Robospice is the only foreground service in our app. It happens only on Nexus 10 running 4.3.
I looked into the source code that SpiceService line 231 could be causing it, it's setting a zero resource icon for the foreground service icon. I guess this might crash on some devices?
FATAL EXCEPTION
android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1423)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(NativeStart.java)
I think Robospice should disable this whole notification hack on devices with Android 4.3 and higher, because it won't work and will cause unpredictable behaviour.
I prefer to force developers to do it properly by adding an abstract method to create the notification properly
DanielNovak [email protected] wrote:
I think Robospice should disable this whole notification hack on devices with Android 4.3 and higher, because it won't work and will cause unpredictable behaviour.
Reply to this email directly or view it on GitHub: https://github.com/octo-online/robospice/issues/227#issuecomment-29230839
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Ok, I see another problem with these notifications. We are getting this exception on Android 4.0.4 Samsung ST25i:
java.lang.NoSuchMethodError: android.app.Notification.setLatestEventInfo
at com.octo.android.robospice.SpiceService.createDefaultNotification(SpiceService.java:229)
setLatestEventInfo is deprecated since API11, it seems they left it out completely on the Samsung smartphone?... Anyway, you have to use the NotificationBuilder to create these notifications.
I thought I had answered yesterday. I am going to have a talk with @rciovati about this. I am inclined to go clean now as @softwaremaverick mentionned it, the new notification model is well enforced by kitkat and it should be backward respected by RS to my mind. But that's an API change and we should do this in a new minor version of RS (i.e. 1.5.0).
@DanielNovak and @softwaremaverick , would you like to create a branch and implement this feature on the basis of @softwaremaverick 's idea ? We could thus prepare release 1.5.0.