Android Question How can i get notification from database


Well-Known Member
Licensed User
Please help i have a database which sends out messages . but i wanted to get the notification on my app even before opening it. because right now i can only get the notification after i have opened the app . how possible can i do this using b4a


Well-Known Member
Licensed User
Longtime User
via Firebase Cloud Messaging (FCM) you can send a notification to a device, then when you click it the app (re)open.
or a app+service combination run non stop at your device. much battery consume.
or a app+timer triggered service starts and poll for messages. no real time messages.
Upvote 0


Licensed User
Longtime User
you can send a notification to a device, then when you click it the app (re)open.
You are free to store the notiificationdata in a DB instead of showing a Notification when the notification comes in...

Or what exactly is the question?

Sorry, i do have makumbi on my Ignorelist. For me it looks like your post is the first post. I now realized that you are giving a answer here. So the above should go to @Makumbi
Upvote 0


Well-Known Member
Licensed User
That´s NOT true!
This is what i was trying out the notification comes only wen i have opened were NB6 is a library which handles customized notifications
Sub Notify
    cursor1 = Starter.SQL1.ExecQuery("SELECT phone AS Phone,Sex FROM Register")
    If cursor1.RowCount > 0 Then
        cursor1.Position =0
        Dim Phonet As String
        Phonet = cursor1.Getstring("Phone")
        Dim sx As String
        sx = cursor1.Getstring("Sex")
        '    sx = "Father"
    End If
    Dim CustID As String = Phonet' Customer ID
    Dim jtk As HttpJob
    jtk.Initialize("", Me)
    'j.Download("" & CustID)
    jtk.Download("" & CustID & "&bcode=" & sx)
    'jtk.Download("" & CustID & "&bcode=" & sx)
    jtk.GetRequest.Timeout = 10000 ' 10 seconds
    Wait For (jtk) JobDone(jtk As HttpJob)

    If jtk.Success Then ' if job is success (http status code 200)
        Dim RetVal As String
        RetVal = jtk.GetString
        If jtk.GetString = "[]" Then
            'Msgbox("Please try Again ","SMIS")
            Dim jpt As JSONParser
            Log(jpt) ' will pr
            Dim quotes As List = jpt.NextArray
            For Each quot As Map In quotes
                Log("Account: " & quot.Get("Account"))
                Log("sms: " & quot.Get("sms"))
                Log("Datesent: " & quot.Get("Datesent"))
                Dim n As NB6
                n.Initialize("default", Application.LabelName, "HIGH").SmallIcon(smiley)
                n.Build(quot.Get("sms"), "Content", "tag", Me).Notify(9)
        End If
    End If
End Sub
Upvote 0