The first thing you’ll want to do when setting up PNs is to go into the UserWise dashboard > Settings > Push Notification Frameworks so you can add your Firebase API Key and APN.
Android Push Notifications:
For the FCM key you’ll need to log into your firebase console > gear icon > project settings > cloud messaging and grab your Cloud Messaging API (Legacy) Server key. Note - you’ll need to make sure this is enabled for your account.
If you need to enable this, you can do so by following these steps:
Step 1 Open Firebase console
In the Firebase console, go to Project settings > Cloud Messaging and select Manage API in Google Cloud Console to open Google Cloud Console.
To enable the legacy Cloud Messaging API, take the following steps.
Step 1 Open Firebase console
In the Firebase console, go to Project settings > Cloud Messaging and select Manage API in Google Cloud Console to open Google Cloud Console.
To view the image in full screen, click on the
Step 2 Go to API Library
Go to API Library using the back button as shown below.
Step 3 Find Cloud Messaging API
In the search bar, type "cloud messaging."
In the search results, select Cloud Messaging as shown below.
Step 4 Enable Cloud Messaging API
Click Enable to start using the Cloud Messaging API.
Step 5 Check that the legacy API has been enabled
If you go back to your Firebase console, the Cloud Messaging API should be enabled with a newly generated server key.
Finally add your Server key here in UserWise. Note - this information is not stored with UW for security purposes and will be sent / stored in Amazon SNS.:
Apple Push Notifications:
To setup APNs you’ll need to generate a .p8 file in Apple and add that into UserWise to be able to deliver PNs to your players.
To generate a .p8 key file, go to Apple developer account page , then select Keys under Certificates, Identifiers & Profiles
Click the + button to add a new key
In the new key page, type in your key name and check the Apple Push Notification service (APNs) box , then click Continue.
On the next page, you’ll want to note your Key ID and most importantly click the Download button to download your .p8 file. Note - you will not be able to download this file again.
Next you’ll need to grab your team ID on your main page > Membership Details:
Finally grab your APN bundle ID under App Information > General Information:
Add all those into UserWise:
With that, you should have blue status markers indicating everything is setup:
Back in Unity you’ll want to grab the device token for this player’s device and then register them to UserWise:
DeviceToken = await Firebase.Messaging.FirebaseMessaging.GetTokenAsync(); NotificationPlatform platform = (Application.platform == RuntimePlatform.Android) ? NotificationPlatform.fcm : NotificationPlatform.apns; UserWise.INSTANCE.PushNotificationsModule.RegisterDeviceToken(platform, DeviceToken, (success) => { UnityEngine.Debug.Log("Device token registration succeeded? " + success); });
Once that’s connected, you’re ready to start sending push notifications! More detailed example can be found here.