I'm using NB6 for notification for a service. I'm getting a relatively large number of reports of the following, all from Galaxy devices running Android 6.0:
I did a little investigation and noticed NB6 requires a 24x24 icon. I used a 72x72 icon and loaded it with LoadBitmapResize to 24Dip x24Dip initially. Thinking the DIP unit was actually making the icon larger than 24x24 pixels, I then re-sized the icon to 24x24 and used LoadBitmap. Both still cause the error.
This is the code I'm using to keep the service running and the notification.
My Galaxy S4 running 6.0 doesn't exhibit this error but it is running a custom ROM so maybe it's a Samsung OS tweak that's causing it?
B4X:
android.app.RemoteServiceException:
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2019)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:158)
at android.app.ActivityThread.main (ActivityThread.java:7225)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
I did a little investigation and noticed NB6 requires a 24x24 icon. I used a 72x72 icon and loaded it with LoadBitmapResize to 24Dip x24Dip initially. Thinking the DIP unit was actually making the icon larger than 24x24 pixels, I then re-sized the icon to 24x24 and used LoadBitmap. Both still cause the error.
This is the code I'm using to keep the service running and the notification.
B4X:
Sub Service_Start (StartingIntent As Intent)
GetLocks
Service.StartForeground(nid, Create_Notification(Common.AppName, Common.AppVer))
End Sub
Private Sub GetLocks
LogColor("Getting Locks", Colors.Green)
Try
Dim r As Reflector
r.Target = wifilock
r.RunMethod("acquire")
Catch
LogColor("Aquire WiFiLock Failed!", Colors.Red)
End Try
Try
Awake.PartialLock
Catch
LogColor("Aquire PartialLock Failed!", Colors.Red)
End Try
End Sub
Private Sub Create_Notification(L1 As String, L2 As String) As Notification
Dim BM As Bitmap = LoadBitmap(File.DirAssets, "icon_sm.png")
Dim Target As Object
If Main.Tablet Then
Target=GUI_T
Else
Target=GUI
End If
Dim n As NB6
n.Initialize("default", Common.AppName, "LOW").AutoCancel(False).SmallIcon(BM)
n.SetDefaults(False, False, False) ' Turn off sound, light, and vibrate
Dim Noti As Notification = n.Build(L1, L2, "tag1", Target)
Return Noti
End Sub
My Galaxy S4 running 6.0 doesn't exhibit this error but it is running a custom ROM so maybe it's a Samsung OS tweak that's causing it?
Last edited: