Android Question Problem receive push android 7

Discussion in 'Android Questions' started by uniplan, Feb 9, 2018.

  1. uniplan

    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?
     
  2. KMatle

    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.
     
  3. uniplan

    uniplan Active Member Licensed User

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

    Code:
    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: Feb 12, 2018
  4. Erel

    Erel Administrator Staff Member Licensed User

    You should never send with Firebase console. Only with the B4J code.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice