46
Views
8
Comments
Solved
[Cloud Messaging Plugin (Firebase)] Sending Notifications to Users not working on IOS, but it is work on Android
cloud-messaging-plugin-firebase
Mobile icon
Forge asset by OutSystems
Application Type
Mobile
Service Studio Version
11.54.66 (Build 63364)
Platform Version
11.18.1 (Build 37828)

Sending Notifications to Users not working on IOS, but it is work on Android.

Getting error message, Internal Server Error

Any good ways to find out the reasons behind?

Also, we use the Post API Method, also does not work

2025-02-24 07-31-27
Howard Law
Solution

Dear Ricardo Silva,


I just figured out what has went wrong:

For the current version of Firebase Project, we are no longer able to use APNs Certificates only, we need to switch to APNs Authentication Key in the Firebase Project:

After I generate the Auth Key and upload there, the internal server error is gone.

And it works successfully on IOS device.

BR,

Howard

UserImage.jpg
Ricardo Silva

Hey @Howard Law,

Can you share more info on the issue? How are you triggering the Server Action?

BR.

2025-02-24 07-31-27
Howard Law

Hi,

The Set up is as below:

Mobile app stores each users' platform and device ID to database, for sending them the push notification using the plugin.

 

Both platform can be registered correctly.

However, when we use the Server Action SendNotificationToUsers to Push Notifications to users, Only IOS fails, Android can successfully receive the Notification:


Error message:

Is there any advise you could provide?

Sending Push Notification to IOS and Android, is there any difference on the input parameters?

If yes, please let us know. Thank you in advance.

Regards,

Howard

UserImage.jpg
Ricardo Silva

Hey @Howard Law,

Two questions:

  1. Where are you getting those deviceId values from?
  2. Regarding the Server Action's parameters, I noticed you're filling both "SendToPlatform" and "SendToUsers". This is conflicting as:
    1. "SendToPlatform" sends a notification to all users from those devices
    2. "SendToUsers" sends a notification to the users associated with the tokens.

Not sure what plugin version you're using but there's a new one on Forge that you can use.

BR.

2025-02-24 07-31-27
Howard Law

Thanks for your reply!

Answering your questions in red:


  • Where are you getting those deviceId values from?
    • In the Mobile Application on application start, I run the below logic, it will get the device platform and token, register the device in FCM, this part is all good and those data can be stored in our DB.

  • Regarding the Server Action's parameters, I noticed you're filling both "SendToPlatform" and "SendToUsers". This is conflicting as:
    1. "SendToPlatform" sends a notification to all users from those devices
    2. "SendToUsers" sends a notification to the users associated with the tokens.
      • I haven't tried this part, I thought we need to input those two parameters. Let me try and revert the results
      • Also, I am using the latest version of the Cloud Messaging Plugin

Thanks for your help and idea!

2025-02-24 07-31-27
Howard Law

Hi,

After my testing, the IOS device still cannot receive the push notifications:

It is really frustrating since the root cause is still unknown.

BR,

Howard

UserImage.jpg
Ricardo Silva

Looking at that flow, I noticed the following:

  • You're fetching the token before registering the device. This logic should be reversed.
  • It doesn't answer my question, as it doesn't show me what value is being stored as the deviceId. Still, from what you said, I believe it's the GetToken's Token Output Parameter which is the correct value to use).

From the last test, you mentioned that you still cannot receive the push notification. But are you getting the same error within the Server Action or is the Push Notification simply not appearing?

BR.

2025-02-24 07-31-27
Howard Law
Solution

Dear Ricardo Silva,


I just figured out what has went wrong:

For the current version of Firebase Project, we are no longer able to use APNs Certificates only, we need to switch to APNs Authentication Key in the Firebase Project:

After I generate the Auth Key and upload there, the internal server error is gone.

And it works successfully on IOS device.

BR,

Howard

2025-02-24 07-31-27
Howard Law

I mean, is there anything difference between the payload for IOS and Android?

Thanks!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.