Android Question Android 8.1 - Fatal Exception RemoteServiceException

asales

Expert
Licensed User
Longtime User
I get this error in Crashlytics, mostly with Android 8.1 in devices that I don't know which is the manufacturer (Q8Plus, DroiPad 7F, TECNO POP 3...):
B4X:
Fatal Exception: android.app.RemoteServiceException
Context.startForegroundService() did not the call Service.startForeground()

android.app.ActivityThread$H.handleMessage (ActivityThread.java:1802)
android.os.Handler.dispatchMessage (Handler.java:106)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:857)

I think is related to the Firebase Push Notification.

I tried several codes without success.
Currently my code (FirebaseMessaging) is:
B4X:
Sub Service_Start (StartingIntent As Intent)
    If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
    Sleep(0)

    Service.StopAutomaticForeground
End Sub

Sub Simple_NotificationNB6Txt(title As String, body As String)
    Dim smiley As Bitmap
    smiley = LoadBitmapResize(File.DirAssets, "smiley.png", 24dip, 24dip, False)

    Dim n As NB6
    n.Initialize("default", Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(smiley)
    n.Color(Colors.RGB(35,75,205)) 
    n.BadgeIconType("SMALL").Number(1)
    
    n.BigTextStyle(title, "", body)
        
    Dim p As Phone
    If p.SdkVersion = 23 Then
        Dim notif As Notification =  n.Build(title, body, "fbPush", Main)
        notif.Cancel(1)
        Sleep(50)
        notif.Notify(1)
    Else
        Try
            n.Build(title, body, "fbPush", Main).Notify(1)
        Catch
            Log(LastException)
            ToastMessageShow("Fail in notification!", False)
        End Try
    End If
End Sub
Can I solved this issue with this devices?

Thanks in advance for any tips.
 

asales

Expert
Licensed User
Longtime User
I know this device. It’s a crappy Chinese device.
Yes. My problem is with this kind of devices.
I had more than a thousand errors in the crashlitycs, in the last 30 days, due this devices.
 
Last edited:
Upvote 0
Top