Private Sub CheckBoxUyari_CheckedChange(Checked As Boolean)
If Checked Then
KVS.Put("BildirimlerAcik", True)
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
Else
KVS.Put("BildirimlerAcik", False)
CallSubDelayed(FirebaseMessaging, "Service_Destroy") '<====== here not firing if application still open.
End If
End Sub
Private Sub Timer1_Tick
StartService(FirebaseMessaging)
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
End Sub
FirebaseMessaging
B4X:
Sub Service_Start (StartingIntent As Intent)
xui.SetDataFolder("kvs")
KVS.Initialize(xui.DefaultFolder, "kvs.dat")
If KVS.Get("BildirimlerAcik") Then
If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
Sleep(0)
Service.StopAutomaticForeground 'remove if not using B4A v8+.
Else
StopService(Me)
End If
End Sub
SettingPage
B4X:
Private Sub CheckBoxUyari_CheckedChange(Checked As Boolean)
xui.SetDataFolder("kvs")
KVS.Initialize(xui.DefaultFolder, "kvs.dat")
If...
Calling the sub Service_Destroy does not destroy anything. Put a log there. Guess you´ll see it in the LOG...
The sub is called by the system when the system destroys the service.
Calling the sub Service_Destroy does not destroy anything. Put a log there. Guess you´ll see it in the LOG...
The sub is called by the system when the system destroys the service.
Private Sub Timer1_Tick
StartService(FirebaseMessaging)
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
End Sub
FirebaseMessaging
B4X:
Sub Service_Start (StartingIntent As Intent)
xui.SetDataFolder("kvs")
KVS.Initialize(xui.DefaultFolder, "kvs.dat")
If KVS.Get("BildirimlerAcik") Then
If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
Sleep(0)
Service.StopAutomaticForeground 'remove if not using B4A v8+.
Else
StopService(Me)
End If
End Sub
SettingPage
B4X:
Private Sub CheckBoxUyari_CheckedChange(Checked As Boolean)
xui.SetDataFolder("kvs")
KVS.Initialize(xui.DefaultFolder, "kvs.dat")
If Checked Then
KVS.Put("BildirimlerAcik", True)
Else
KVS.Put("BildirimlerAcik", False)
End If
End Sub