iOS Question [SOLVED] Issue with Firebase Push Notifictions and new B4I App using B4I 10.0

aminoacid

Well-Known Member
Licensed User
Longtime User
I had added Firebase Notifications about a year ago to one of my old B4I apps and it worked right away after carefully following the setup and configuration procedures posted by Erel. So I am familiar with doing this. It still works fine.

Well, I tried to set it up again with a new App (using the updated Firebase Push Notifications 2023+ tutorial - https://www.b4x.com/android/forum/threads/b4x-firebase-push-notifications-2023.148715/ ) and this time compiling with B4I 10.0, but I just could not get the App to receive any notifications.

So I decided to try it again from scratch, one-step-at-a-time this time with the posted B4I PushClients sample Application and the B4J-Sending Tool (FCMPush) posted in the above Tutorial. Here are the steps I followed:

* Created a new Non-wildcard App ID
Enabled Push Notifications and created a Production SSL Push Cert
Downloaded the Certificate (aps*.cer)

* Created a provision file with the same App ID as above

* Created the Push Store - firebase_push.p12 ( Tools - Build Server -> Create Push Store -> Firebase Service)

* Created a new project in Google Firebase Console and a new iOS App.

* Uploaded Push Store (.p12 file above) to Firebase console under Settings - CLOUD MESSAGING - Production APN Certificate

* Downloaded GoogleService-Info.plist and copied it to Files\Special folder

* Generated and Downloaded the private sign key (JSON file for FCMPush) Project settings -> Service accounts -> Generate new private sign key


No changes were made to the sample PushClients App code and FCMPush Code other than updating the ProjectId and ServiceAccountFilePath (to JSON file) in the FCMPush Application and setting #MinVersion: 16 in B4I. I'm also using the same topic "general".

After successfully compiling the B4I App and running it in debug and standalone modes, I still could not receive any test notifications sent by FCMPush. The B4I logs indicate that nothing is received.

Has anyone tried doing this since the major v10.0 update to B4I? I hate to point my finger to any incompatability between v10.0 and Firebase Notifications but I have tried and checked and double checked everything but am at a complete loss on finding the issue? Any thoughts? Thanks!

BTW: I also tried using the new and recommended APN authentication key method but with no success. Also, another worthwhile note - The FCMPush application does send notifications to my old B4I App when I reference the appropriate ProjectId and ServiceAccountFilePath. So it appears that the FCMPush Application is working fine.
 
Last edited:
Solution
I do indeed see an issue with topics subscription. It looks like subscriptions silently fail if they are done before the APN token is available. I've updated the example: https://www.b4x.com/android/forum/threads/b4x-firebase-push-notifications-2023.148715/page-2#posts

That did it. Thank You!

I tested it out using the APN Key instead of the APN Certificates.

Just want to clarify and confirm a few things for the benefit of others who may be a bit confused with using the APN Key Method instead of the APN Push Certificates:

* The APN Key method is definitely easier to implement and does not expire like the certificates.

* You DO NOT need to create any APN Push Certificates and bind them to your App ID. Skip that step...

Erel

B4X founder
Staff member
Licensed User
Longtime User
Has anyone tried doing this since the major v10.0 update to B4I?
Yes. Everything is working as before.

Created the Push Store - firebase_push.p12 ( Tools - Build Server -> Create Push Store -> Firebase Service)
This step is no longer needed.

Use authentication keys:

1770620294192.png
 
Upvote 0

aminoacid

Well-Known Member
Licensed User
Longtime User
Yes. Everything is working as before.


This step is no longer needed.

Use authentication keys:

View attachment 169757
Thanks for the confirmation. I'm going to delete everything and start over.

Question - If there is no need to create the .p12 file, is there any need to create the SSL push certificate (aps.cer) ?
 
Last edited:
Upvote 0

aminoacid

Well-Known Member
Licensed User
Longtime User
It has been a while since I've updated an auth key, but if I remember correctly it is not needed.

Yes, that makes sense. Unfortunately I have tried everything possible to get the sample push client example to work, include deleting everything including the project and starting from scratch several times, with no success. The app is just not receiving any notifications. I am absolutely sure the procedure is correct since I have successfully done it many times before. In addition, I had recompiled the old app that I had with B4I v10.0 and the Firebase Notifications work fine. All I can conclude is that there must be some setting in the Goggle Firebase Console or the new API (V1) that is not enabled or configured properly when I create a new project ... have to do some more research.
 
Upvote 0

aminoacid

Well-Known Member
Licensed User
Longtime User
I had recompiled the old app that I had with B4I v10.0 and the Firebase Notifications work fine.

Correction to my statement above. When B4I 10.0 was released, I compiled the "old" app with B4I v10.0 and it compiled and ran fine. But I never did test out the notifications.

Today I tested out the "old" app (unmodified) which was compiled with B4I v10.0 and the notifications did not work. The same app which had been previously compiled with B4I 8.x is still working with notifications being received on another device.

Now I'm beginning to wonder if there is an issue with Apps compiled with B4i v10.0 not receiving Firebase Notifications.
 
Upvote 0

aminoacid

Well-Known Member
Licensed User
Longtime User
I do indeed see an issue with topics subscription. It looks like subscriptions silently fail if they are done before the APN token is available. I've updated the example: https://www.b4x.com/android/forum/threads/b4x-firebase-push-notifications-2023.148715/page-2#posts

That did it. Thank You!

I tested it out using the APN Key instead of the APN Certificates.

Just want to clarify and confirm a few things for the benefit of others who may be a bit confused with using the APN Key Method instead of the APN Push Certificates:

* The APN Key method is definitely easier to implement and does not expire like the certificates.

* You DO NOT need to create any APN Push Certificates and bind them to your App ID. Skip that step entirely.

* You can only create two APN Keys in Apple Developer Console. That's because the Key is Team Scoped (for all topics) and not tied to any particular App. Therefore you can use the same key for multiple Apps. You do not need to create a new key each time.
 
Upvote 0
Solution

Stevenindonesia

Member
Licensed User
Good day to all,

I used to have my app in IOS receiving notification without problem until recently (1 month ago). I try to trouble shoot by downloading PushClients.zip from https://www.b4x.com/android/forum/threads/b4x-firebase-push-notifications-2023.148715/#content.

After Adding the SubscribeToTopics, I am still not able to get the Token.
*Please see image file

I sent notification using my php :
Android : Received notification
IOS : No notification

I downloaded B4J Sending tools too ... but always return 404

Please help.
 

Attachments

  • Token.jpg
    Token.jpg
    31.3 KB · Views: 33
Last edited:
Upvote 0

aminoacid

Well-Known Member
Licensed User
Longtime User
Good day to all,

I used to have my app in IOS receiving notification without problem until recently (1 month ago). I try to trouble shoot by downloading PushClients.zip from https://www.b4x.com/android/forum/threads/b4x-firebase-push-notifications-2023.148715/#content.

After Adding the SubscribeToTopics, I am still not able to get the Token.
*Please see image file

I sent notification using my php :
Android : Received notification
IOS : No notification

I downloaded B4J Sending tools too ... but always return 404

Please help.

Did you run the B4I "PushExample" that was updated by Erel on Feb 11th? It should work fine without any changes with the B4J FCMPush program.

I suggest you try that first.

I assume that your certificate has not expired (if you are using a cert and not an APN Key)
 
Upvote 0
Top