B4J Question Automating FirebaseNotifications Push from B4J On Every nth Minutes

A Z M JANNAT UL KARIM

Member
Licensed User
Hi, I have successfully integrated Firebase Notifications to the Android Apps B4J Push. I want to send Push Notifications on every 15 Minutes to wake the device up. How to do it, if anyone helping here. Thank you.
 

DonManfred

Expert
Licensed User
Longtime User
Where is the problem? Use a timer in your server app and Send a Pushnotification every 15 Minutes.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
B4J_FCM_PUSH.zip This is aB4J App to send Pushes.

A B4J Timer works the same like in Android. Use a Timer, Initialize and Enable it and use the Timer Tick to do something.

Don´t expect me to write a tutorial for you to use a timer! Learn the Language.
See the B4J Server Tutorials to learn how to setup a Server with B4J.
 
Upvote 0

A Z M JANNAT UL KARIM

Member
Licensed User
Hi DonManfred, thank you for your light. I had done it with following process and it works like a charm ...

B4X:
Sub Process_Globals
    Private const API_KEY As String = "XXXX"
    Private getLocTimer As Timer
End Sub

Sub AppStart (Args() As String)
    getLocTimer.Initialize("getLocTimer", 900000) ' Run Every 15 Minutes
    getLocTimer.Enabled = True
    getLocTimer_Tick
    StartMessageLoop
End Sub

Private Sub getLocTimer_Tick
    SendMessage("getloc", "Checking Status", "Status Checking - " & DateTime.Now)
End Sub

And I commented StopMessageLoop from JobDone as it closes the loop ...

B4X:
Sub JobDone(job As HttpJob)
    Log(job)
    If job.Success Then
        Log(job.GetString)
    End If
    job.Release
    ' StopMessageLoop '<-- non ui app only
End Sub

Hope I am right here. Thank you :)
 
Upvote 0
Top