Android Question FirebaseMessaging service

Ghaston2021

Member
hello,

i want call sub from firebasemessaging service when the message is received.
the sub in the main activity.

please help me
 

DonManfred

Expert
Licensed User
Longtime User
Update your B4A Version and probably update your SDK.

Also you need to adapt your code to use Receiver instead of Service.

See the updated tutorial:
 
Last edited:
Upvote 0

Ghaston2021

Member
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 ?
 
Upvote 0

Ghaston2021

Member
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
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
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
My app is based on many panels in activity , i wish that's simple to switch to B4XPages.
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:
Source: https://www.b4x.com/android/forum/threads/android-jar-targetsdkversion-minsdkversion.87610/
 
Upvote 0

Ghaston2021

Member
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
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
B4X:
'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
 
Upvote 0
Top