Android Question FireBase RuntimeException

ilan

Expert
Licensed User
Longtime User
hi

i am getting lately some crash reports in my console on android 8 in my firebase service.
i have followed the tutorial (how serviced are working in android 8) and also the firebase tutorial but still get those crashes. the weird thing is that i am not sending any push messages to the devices so it happens i guess on app start where i initialize firebase or something like that.

any ideas why i am getting it?

 

ilan

Expert
Licensed User
Longtime User
A possible cause of this error is the usage of an old FirebaseNotifications.jar. Open the internal libraries folder and check the size of FirebaseNotifications.jar. It should be 9506 bytes.

ok, just checked and i have 8,836 byte

last date modified 22/1/2017

btw i have this in my starter Service_Create


B4X:
    Try
        CallSubDelayed(FirebaseMessaging, "SubscribeToTopics") 'notification test
    Catch

       Log(LastException)
    End Try

and this is my FB Service:

B4X:
'FirebaseMessaging
#Region  Service Attributes
    #StartAtBoot: False
#End Region

Sub Process_Globals   
   Private fm As FirebaseMessaging
End Sub

Sub Service_Create
   fm.Initialize("fm")
End Sub

Public Sub SubscribeToTopics
    Try
        If Starter.sendNotifaction Then fm.SubscribeToTopic("mysalarynew") 'you can subscribe to more topics
        fm.SubscribeToTopic("mysalarynewversion")
'        fm.SubscribeToTopic("mytests")   
'        fm.SubscribeToTopic("mytestsnew")   
    Catch
        Log(LastException)
    End Try
End Sub

Sub Service_Start (StartingIntent As Intent)
   If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
   Sleep(0)
   Service.StopAutomaticForeground 'remove if not using B4A v8+.
End Sub

Sub fm_MessageArrived (Message As RemoteMessage)
    Log("Message arrived")
    Log($"Message data: ${Message.GetData}"$)
        
    Try
        Dim title As String
        title = Message.GetData.Get("title")
        title = title.Replace(" ","")
        If title = "promo" Then
            Dim str() As String = Regex.Split("\|",Message.GetData.Get("body"))
            Starter.promolink = str(2) 
            Dim n As Notification
            n.Initialize
            n.AutoCancel = True
            n.Light = True
            n.Sound = False
            n.Vibrate = True
            n.Icon = "icon"           
            n.SetInfo(str(0), str(1), openlink)
            n.Notify(1)   
        else if title.Contains("newversion") Then 'new version
           Starter.promolink = "https://play.google.com/store/apps/details?id=www.sagital.mysalarynew"
           Dim n As Notification
           n.Initialize
           n.AutoCancel = True
           n.Light = True
           n.Sound = False
           n.Vibrate = True           
           n.Icon = "icon"
           n.SetInfo("יצא עדכון חדש לשכרניק", "יצא עדכון חדש, מומלץ לעדכן את שכרניק!", openlink)
           n.Notify(1)   
        Else
           Dim n As Notification
           n.Initialize
           n.AutoCancel = True
           n.Light = True
           n.Sound = False
           n.Vibrate = True           
           n.Icon = "icon"
           n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
           n.Notify(1)               
        End If       
    Catch
        Log(LastException)
    End Try
End Sub

Sub Service_Destroy

End Sub
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
You are using an old version of FirebaseNotifications. You have probably copied it at some point to the internal libraries folder.

I recommend you to delete all internal libraries and reinstall B4A.

if i install b4a again will it not overwrite all old libraries?
how do i know what are all internal libraries? i have a lot 3rd party libraries.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
sorry i did a mistake, i have copied by mistake the firebasenotification.jar to basic4android folder and not to libraries folder and this is the jar i checked that has 8836 but if i check in my basic4android/libraries folder i do see the jar in the correct size (9506)

i just deleted the false jar but i believe that b4a used the jar in the libraries folder that should be the right one.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…