Hello, i followed this tutorial migrating from fcm service to fcm receiver, yes it is working, with the app in foreground or background the notification is showing, the problem is :
with code above i can't get the message insert into table when the apps in the background otherwise it is working fine, need assitance, thanks.
sql insert:
Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent)
If FirstTime Then
fm.Initialize("fm")
End If
If sql1.IsInitialized = False Then
sql1.Initialize(File.DirInternal,"main.db",True)
End If
fm.HandleIntent(StartingIntent)
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
If checkTableexist("pesan") Then
Dim logo As Bitmap = LoadBitmapResize(File.DirAssets, "single-icon.png", 24dip, 24dip, True)
Dim n As NB6
n.Initialize("default", Application.LabelName, "HIGH").SmallIcon(logo).AutoCancel(True)
Dim cs As CSBuilder
n.BigTextStyle(Message.GetData.Get("title"), cs.Initialize.BackgroundColor(Colors.Red).Append("").PopAll,Message.GetData.Get("body"))
n.Build(Message.GetData.Get("title"), "", "tag",pesan).Notify(1)
sql1.ExecNonQuery2("insert into pesan (judul,isi) values (?,?)",Array As Object(Message.GetData.Get("title"),Message.GetData.Get("body")))
End If
End Sub
with code above i can't get the message insert into table when the apps in the background otherwise it is working fine, need assitance, thanks.