B4A Library FirebaseNotifications - Push messages / Firebase Cloud Messaging (FCM)

Discussion in 'Additional libraries, classes and official updates' started by Erel, Jun 9, 2016.

Thread Status:
Not open for further replies.
  1. biometrics

    biometrics Active Member Licensed User

    I thought I needed all of them. My mistake.
     
  2. DonManfred

    DonManfred Expert Licensed User

    No problem. You got it working now. That´s what count.
     
  3. Manolete

    Manolete Member Licensed User

    Hello, is there a chance to add an "Action" to the Notificarion?
    Like when you receive a Twitter notification, there is a row in the bottom of the notification with a couple of actions like "Share" or somotehing like that.

    Is this possible?

    Thanks,
    Manolete
     
  4. DonManfred

    DonManfred Expert Licensed User

    - The Notification is build in the firebasemessaging service.
    - The Notification is just a standard-notification.

    Feel free to replace the standard notification with a notification build with the NotificationBuilder.
     
  5. Manolete

    Manolete Member Licensed User

    Hi DonManfred,

    Thanks a lot, I will use it right now!

    I appreciate the excellent help and support.
    Regards,
    Manuel
     
  6. Croïd

    Croïd Active Member Licensed User

    Please where thread solution #272 ?

    works fine with console firebase only !

    Code:
    [jobname=fcm, success=true, username=
    , password=, errormessage=, target=class b4j.example.main
    , taskid=
    1, req=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest@3c4b1fb8, tag=java.lang.Object@7267e742
    , fx=anywheresoftware.b4j.objects.JFX@2fac8a71, httputils2service=
    null]
    {
    "message_id":8878541930547848266}
     
    Last edited: Aug 22, 2017
  7. DonManfred

    DonManfred Expert Licensed User

    Please create a new thread for your question.
    Post all relevant infos.
    DONT POST ERROR AS IMAGE. Post it as TEXT!

    Search the forum for similar problems... I´m sure it is asked in the past.
     
  8. Croïd

    Croïd Active Member Licensed User

    #272 Don
     
    Last edited: Aug 22, 2017
  9. DonManfred

    DonManfred Expert Licensed User

    I saw the PICTURE!
    And i told you to post errors as text. In a newly created thread.

    DON´T expect any more answers from me. I´ll put you on my ignore list. I´n not interested in helping here. Even i´m not interestent to spent my time for this.

    Good luck.
     
  10. Croïd

    Croïd Active Member Licensed User

    Sorry Don, I modified to not mislead others !! and I deleted image as requested
     
  11. DonManfred

    DonManfred Expert Licensed User

    A last try to help:
    Based on the error the server key seems to be wrong.
    Look at the FCM tutorial and watch out how to get the server-key
    Use the serverkey to send a notification.
     
  12. Croïd

    Croïd Active Member Licensed User

    Thanks Don and Sincerely sorry for my mistake
     
  13. Kwame Twum

    Kwame Twum Active Member Licensed User

    Hello everyone, I'd like to know if the FCM Sender ID is mentioned any where in the Library or it's implementation. An app I'm building currently can't receive messages from my server nor from the FCM notifications console. I've been through all the necessary steps.

    I cURLed the FCM server with both the Server Key and a generated Token from the app and got back the response in red:

    Code:
    curl --header "Authorization: key=AAAAeArR1Dg:APA91bH4GAkOSEcnLU-XXXXXXWB29u70MUM7wQ" \
         --header Content-
    Type:"application/json" \
         https://fcm.googleapis.com/fcm/send \
         -d 
    "{\"registration_ids\":[\"cHKKRHRVVWw:APA91XXXXXXXXOaB1kl2t8\"]}"

    {"multicast_id":8444809106756048113,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}

    I've reported the matter to the FCM support and apparently, the Server key doesn't match the Sender ID. I know the Server Key is correct because I copied it from the FCM Console. The Sender ID however is not mentioned anywhere in my app. So the MismatchSenderId error is quite baffling.

    The google-services.json file however contains the correct Sender ID from the FCM console.
    FCM support asked me to check my code as I might be generating a token for multiple sender id. A bit confused here. Any help is greatly appreciated. Thank you.

    PS. I already have another app working well with FCM, it sends and receives payloads just fine. So I know I've done what needs to be done.


    EDIT: SOLVED!
    I found this file: googleservices.xml in the res/values folder.

    I guess this file is supposed to be deleted and regenerated on every compile. But it somehow stays the same. My guess is: It's been so ever since a previously deleted FCM project I used and this xml file mentions the Sender ID from the deleted project.

    The file was marked readonly, after removing the readonly attribute and recompiling, it now references the correct Sender ID. I hope this helps someone else.
     
    Last edited: Aug 31, 2017
    fredo likes this.
  14. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for your question.
     
  15. peacemaker

    peacemaker Well-Known Member Licensed User

    What is the use of
    Code:
    If StartingIntent.IsInitialized AND fm.HandleIntent(StartingIntent) Then Return
    ?
    Why Return ?
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    The return is not very important if you are using the example code as this is the last line there anyway. It just means that the StartingIntent was handled.
     
    luke2012 and peacemaker like this.
  17. paul fredrick

    paul fredrick Member Licensed User

    i have tested FirebaseNotification and FirebaseAuth... works, but i would like to store the token when user subscribe with google-service or with another metod

    Public Sub SubscribeToTopics
    fm.SubscribeToTopic("general") 'you can subscribe to more topics
    Log(fm.token)
    End Sub

    when user sign in store ID in authentication tab, but this ID not works to SendMessageToSingleDevice

    Sub Auth_SignedIn (User As FirebaseUser)
    Log("SignedIn: " & User.DisplayName)
    lblName.Text = "Hello: " & User.DisplayName
    auth.GetUserTokenId(User,False)
    End Sub

    Thanks
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread in the questions forum and make sure to use code tags.
     
  19. incendio

    incendio Well-Known Member Licensed User

    Is there a time limitation for unsent notification to the devices?

    For example, targeted devices not have internet connection for a week, will notification still send after devices get active internet connection?
     
  20. Erel

    Erel Administrator Staff Member Licensed User

Thread Status:
Not open for further replies.
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