Google has deprecated the previous method of sending push notifications. It will stop working on June 2024. If you have an already working solution then you only need to update the B4J side. Do make sure that you switched from the service to a receiver on B4A. The new API is (confusingly) named...
the notification run , but i want to call other sub in the activity to refresh data on customlistview
when message is arrived
i'm trying to put callsub,callsub2,calsubdelayed... but nothing happened
you mean that the callsub must be instead reciever_receive sub ?
the notification work , but when message is arrived i want to call other sub in the activity to refresh data on customlistview
i'm trying to put callsub,callsub2,calsubdelayed... but nothing happened
1. Switch to B4XPages.
2. Check whether B4XPages.IsInitialized is true. It will be false if the process just started because of the notification.
3. Call the sub directly:
the notification work , but when message is arrived i want to call other sub in the activity to refresh data on customlistview
i'm trying to put callsub,callsub2,calsubdelayed... but nothing happened
Is your app in the foreground? On newer versions of Android (10+), a service/receiver cannot bring an activity to the foreground when the app is not in the foreground.
Additional changes in Android 10 that are not related to the targetSdkVersion value:
this is the code of the service (firebasemessaging ) :
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
Dim n As Notification
n.Initialize2(n.IMPORTANCE_DEFAULT)
n.Icon = "icon"
n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
n.Notify(1)
'i want add callsub here
End Sub
i'm doing a push notification with b4j and i save the data in the database in the same time.
i have a sub the refresh data of customlistview in the main activity .
if my app in the foreground and i receive a message i want to refresh customlistview on runtime
'i want add callsub here
If Not(IsPaused(Main)) Then
'Use CallSub/CallSubDelayed here
Else
'Optionally set some flag here that lets Main know that it needs to
'update it's customlistview the next time Main's Activity_Resume happens
End If