Android Question Problem receive push android 7

uniplan

Active Member
Licensed User
Hi...i have a particular problem on devices android with Android 7 version (Samsun s6 and Huawei P10) .I don't receive the push notification.
With the same app on other device with android 6, i haven't this problem (Samsun Note 3).
There are any type of problem?

Thank you?
 

KMatle

Expert
Licensed User
Hard to say without seeing anything. How do you send the messages? (I assume via OkHttpUtils or php). What is the job's/curl's response? Do you use the correct token? Did you check the apps energy setting? On my P10 everything works as usual.
 

uniplan

Active Member
Licensed User
I subscribe a topic with firebase (for example generic topic)
B4X:
    fm.SubscribeToTopic("general")
and i send push notification to the all smartphone subscribed on this topic (i try with firebase console and java code)

B4X:
Sub Process_Globals
   Private const API_KEY As String = "AAAAXXXXXXXXXXXXXXX--------XXXXXXXXX"
End Sub

Sub AppStart (Args() As String)
    SendMessage("general", "Benvenuto", "Hello!!!!")

    StartMessageLoop
End Sub

Private Sub SendMessage(Topic As String, Title As String, Body As String)
    Dim Job As HttpJob
    Job.Initialize("fcm", Me)
    Dim m As Map = CreateMap("to": $"/topics/${Topic}"$)
    Dim data As Map = CreateMap("title": Title, "body": Body,"id_notifica":"123")
    m.Put("data": data)
    Dim jg As JSONGenerator
    jg.Initialize(m)
    Job.PostString("https://fcm.googleapis.com/fcm/send", jg.ToString)
    Job.GetRequest.SetContentType("application/json")
    Job.GetRequest.SetHeader("Authorization", "key=" & API_KEY)
End Sub
I receive this notification on two phones ( with android 6), but not on another two phones (Android 7)

i see now...that with firebase i received nulle title and null message
 
Last edited:

Erel

Administrator
Staff member
Licensed User
You should never send with Firebase console. Only with the B4J code.
 
Top