Android Question [SOLVED] FCM - Unsubscribe from all topics

ThePuiu

Active Member
Licensed User
Longtime User
Hello!
I have an application written a few years ago that used the old version of FCM. The client informed me that he no longer receives notifications if the application is closed. I modified the application according to the instructions provided here and now it works. I want to implement a facility to unsubscribe the user from all topics where he is subscribed (I don't know which topics he was connected to so that I can disconnect them individually) before subscribing to a new topic. Until now, in the Service module where FirebaseMessaging was initialized, we had a working code:
Sub Process_Globals
Private fm As FirebaseMessaging
Dim Thread1 As Thread
End Sub
Sub Service_Create
fm.Initialize("fm")
Thread1.Initialise("Thread1")
End Sub
Public Sub UnsubscribeAll()
Dim args(0) As Object
Thread1.Name = "unsubscribe"
Thread1.Start(Null, "Thread1_Start", args)
End Sub
Sub Thread1_Start
Dim jo As JavaObject
Try
jo = jo.InitializeStatic("com.google.firebase.iid.FirebaseInstanceId").RunMethod("getInstance", Null)
jo.RunMethod("deleteInstanceId", Null)
Catch
Log(LastException)
End Try
End Sub
Sub Thread1_Ended(fail As Boolean, error As String) 'An error or Exception has occurred in the Thread
If fail Then
Log ($"Thread1 Ended with error : ${error}"$)
Else
Log ("Thread1 Ended without error")
End If
End Sub

now the code no longer works and returns the error: (ClassNotFoundException) java.lang.ClassNotFoundException: com.google$firebase$iid$FirebaseInstanceId

What should I change? Thank you!
 
Top