[Unity Push Notification] Exception message "Failed to initialize Push Notification plugin ..."

Hello :wink: ,

I think I made all setup inside the this document correctly (Like Firebase, Unity Editor, Unity Dashboard). No error during the build process. But when I open my Android device, I got this error message when run the
RegisterForPushNotificationsAsync method**:**

Failed to initialize Push Notification plugin instance and register the device for remote notifications

  • The build was made on Unity Cloud Build (2022.2.13f1)
  • Iā€™m using the same script sample to test
  • Iā€™m testing an apk (not a published build)

[EDIT]

  • I made a local build (2022.2.12f1) and got the same error

[OBS]

  • I geeting this message before the exception message:

FirebaseApp: Device unlocked: initializing all Firebase APIs for app UNITY_PUSH_NOTIFICATIONS

Hi rdossantos,
thanks for posting on the forums.
Is this a sample project? If so would it be possible to send me the project in a DM?

I would love to explore the code and see what may be going wrong. What version of the Push Notifications Beta are you currently using?

Thanks, @SebT_Unity .

  • Itā€™s not a sample project. Iā€™m implementing direct to a company project because we already have some configs like Firebase
  • Iā€™m using the Push Notification 3.0.1-pre.1

My configs:

8941890--1226667--upload_2023-4-11_18-3-23.png

[OBS] If this can help:

1 Like

[ANDROID UPDATE]

  • Trying to fix other SDK integration I team member tell me that our Android Resolver is not automatically running, so a need to run it manually.
  • After that the RegisterForPushNotificationsAsync worked :wink: The push token was generated and I can send a Test Push Notification
    - My suggestion is to add on the guide this part

[IOS UPDATE]

  • Iā€™m getting some iOS errors during the XCode build process on Unity Cloud Build. But Iā€™m testing more to see if I can find the solution.

@SebT_Unity

[IOS UPDATE]

Iā€™m getting the error below while Iā€™m building on Unity Cloud Build.


Error Detail:
- INFO: ā–ø :x: error: Provisioning profile ā€œ----ā€ has app ID ā€œ----ā€, which does not match the bundle ID ā€œ----.notificationserviceā€. (in target ā€˜notificationserviceā€™ from project ā€˜Unity-iPhoneā€™)

I search on the project about the notificationservice key and saw that Push Notification Process appends this information to my identifier.

Question:

  • What do I have to make to work?

Extra Info:

  • Unity Version: Unity 2022.2.11f1
  • Xcode Version: Xcode 13.4.1
  • Ruby version: 2.7.4

I will move the last question to a new topic. To be more specific:

Topic Link

Hey,
i cant register my app, too. Only get the exception while running my mobile app ā€œFailed to register the device for remote notificationā€. (only trying it for Android)

I think i followed all steps written in the documentary

  • imported the push-notification sdk 3.01 Preview
  • Create a Firebase account for my game and import the google-services.json
  • generate an service account key
  • add generated key to Liveops->Push Notifications ā†’ Settings
  • add all information about firebase to Unity->projectsetting ->Push notifications
  • enable Cloud Messaging API (Legacy) in firebase

I am using Unity 2021.3.8 and my mobile phone using version 12.
I Copied the code above and resolve with the android resolver, but the exception is still triggered.

Does anyone have an idea how i to solve this?

Hey, @Dan-Lyrebird

  • Are you added the Push Notification API Keys for android?

Hey @rdossantos_unity ,
Yes i added the key and using my development environment in my current build. (Like in Remote Config, Analytics, Leaderboard etc.)

@rdossantos_unity

I had the same symptoms as you. In my case, There was an additional space character at the end of the ā€œFirebase App Keyā€ because I had copied the id by just doubleclicking in the web browser.
After removing the space , I could get the push registration token.
Hope this helpsā€¦