iOS Tutorial FirebaseNotifications / Push Messages (server not required)

Discussion in 'iOS Tutorials' started by Erel, Jul 5, 2016.

Thread Status:
Not open for further replies.
  1. valentino s

    valentino s Active Member Licensed User

    If I have more than one aps*.cer file in the key folder I can't create a filebase service and the file firebase_push.p12

    This is the error.

    2016-09-13_110708.jpg

    If I delete all aps*.cer files except one, it works.

    So I can I manage multiples aps_ files for different projects ?

    This happens because when I create a push notifications certificate and, Apple let me download a file called aps.cer and not aps_name.cer ?


    Thanks
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Move the other aps* files to a different folder before you create the push key. Your app doesn't need the push key. It is only needed once when you upload it to Firebase console.
     
    valentino s likes this.
  3. fabio borges

    fabio borges Member Licensed User

    Hi guys,
    my notification is not being sent and I cant know why.
    When I send notification from Firebase console to general, this works, but not by token.
    So, I'm trying to send notification direct of the ios application for firebase using Java, with the following library (https://github.com/Raudius/Pushraven) but I dont really know if this is working, there is any way of knowing if the notification is getting in the Firebase?

    And assuming that the notification is in Firebase, I'm doubts whether my application in B4i is working properly.

    Below is the log when I run the application with B4iBridge.
    I am using the certificate in the development mode.

    Application_Start
    The default app has not Been configured yet.
    Configuring the default app.
    Application_Active
    FCMConnect
    HERE
    Application_Pushtoken
    token = 384CB0332C *
    Application_Pushtoken
    token = 384CB0332 *
    Application_Pushtoken
    token = 384CB0332C9C *
    Error response:, status code: 0
    Error uploading token
    Class (b4i_httpjob) instance released.
    Error response:, status code: 0
    Error uploading token
    Class (b4i_httpjob) instance released.
    Error response:, status code: 0
    Error uploading token
    Class (b4i_httpjob) instance released.
    FCMConnected
    OVERhttp: //192.168.0.102: 8084 / ZipWeb / mobile /
    http://192.168.0.102:8084/ZipWeb/mobile/
    OVERhttp: //192.168.0.102: 8084 / ZipWeb / mobile / home /
    http://192.168.0.102:8084/ZipWeb/mobile/home/
    OVERhttp: //192.168.0.102: 8084 / ZipWeb / mobile / authCookie
    http://192.168.0.102:8084/ZipWeb/mobile/authCookie
    OVERhttp: //192.168.0.102: 8084 / ZipWeb / mobile / home /
    http://192.168.0.102:8084/ZipWeb/mobile/home/
    OVERhttp: //192.168.0.102: 8084 / ZipWeb / mobile / home / # / ZipWeb / mobile / budgets
    OVERhttp: //192.168.0.102: 8084 / ZipWeb / mobile / # budgets / ZipWeb / mobile / home
    Application_Inactive
    Application_Background
    FCMDisconnect
    Application_Foreground
    Application_Active
    FCMConnect
    FCMConnected


    Some hint of what else should I check?
    Thank you!
     
  4. fabio borges

    fabio borges Member Licensed User

    I just checked that the Firebase connection is returning code 200, so, is probably something with my b4i application.

    How can I check it?
    I'm sending a attached with my Main Application, so you can check.

    Thank you!!
     

    Attached Files:

  5. Erel

    Erel Administrator Staff Member Licensed User

    Please use the B4J program attached to the first post to send messages.
     
  6. fabio borges

    fabio borges Member Licensed User

    Ok, did it, I just changed the API_KEY in the b4j file, and I got the following log:

    Program started.
    [jobname=fcm, success=true, username=
    , password=, errormessage=, target=class b4j.example.main
    , taskid=1, req=anywheresoftware.b4a.http.HttpClientWrapper$HttpUriRequestWrapper@1410acf, tag=java.lang.Object@1089e5f
    , main=null, httputils2service=null]
    {"message_id":8090239757702940595}


    But the notification isn't reaching my phone!
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Have you subscribed to the ios_general topic?

    If it doesn't work then your keys are probably misconfigured. Delete them and carefully follow the steps from the tutorial (first post).
     
    f0raster0 likes this.
  8. andyr00d

    andyr00d Member Licensed User

    ok I've tried this 3 times now... At the end when I upload the .p12 file to Firebase console, I am getting: The Bundle ID in the certificate does not match the Bundle ID you entered.

    I've followed the steps carefully, is it the package name in build configurations that is causing it?
    To be clear: I've copied the push.mobileprovision and aps.cer files to my keys folder
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Bundle id is the package name. Maybe you set the incorrect package name in your firebase project.
     
  10. andyr00d

    andyr00d Member Licensed User

    The package name in build configurations is the same as my Firebase iOS project name... any other suggestions?
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    Open the aps_*.cer file with a text editor and see whether the package name matches your app and matches the firebase app package name.
     
  12. andyr00d

    andyr00d Member Licensed User

    Ah that worked! it had a "1" after the name, so I recreated it all and now it's fine. Thanks!
     
  13. tufanv

    tufanv Expert Licensed User

    my app started not receiving push messages as notifications while on background. Only when i open the app it is coming as msgbox. 2 days ago everything was working fine . I am sure that i use
    App.RegisterUserNotifications(True, True, True) 'allow badge, sound and alert
    and i allow it. I tried at different devices also. What may be the problem to make it stop working suddenly =
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    Implement this sub and see whether there are any errors:
    Code:
    Sub Application_PushToken (Success As Boolean, Token() As Byte)
       
    Log($"PushToken: ${Success}"$)
       
    Log(LastException)
    End Sub
     
  15. tufanv

    tufanv Expert Licensed User

    it says push token : 0 could not find a aps-environment .

    But why did this start hapening suddenly ? what to do to fix it ?
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    Are you using a local builder with Xcode 8?
     
  17. tufanv

    tufanv Expert Licensed User

    no, I am using hosted builder only
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    iOS 10?
     
  19. tufanv

    tufanv Expert Licensed User

    yes ios 10
     
  20. Erel

    Erel Administrator Staff Member Licensed User

    I plan to release B4i v3.0 BETA next week. It will solve this issue.
     
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