Push Notifications
Skillz has a built-in set of automatic push notifications that are sent based on in-game actions to drive player engagement and retention. Uploading a push notification certificate to Skillz doesn't prevent you from sending your own messages using normal methods, such as first & third-party push notification tools, etc.
In order to tell the difference between your game’s notifications and the notifications sent by Skillz, you can look in the dictionary of the notification payload. If it contains a property for SKZVersion
, then you know it is a Skillz notification.
This article will walk you through on how to enable push notifications.
Setup Push Notifications
- iOS
- Android
1. Generate a Push Notification Certificate
- Generate an APNs client TLS certificate for your app ID. Remember to download the certificate and add it to your Mac keychain.
- Regenerate the provisioning profile(s) for your app ID.
- Update your XCode project with the regenerated provisioning profile.
- Add the "Push Notifications" capability in your XCode project. It is found under
Signing and Capabilities
.
2. Export the Certificate in PKCS #12 (.p12) Format
The certificate needs to be exported as a p12 file, as it contains the certificate, its chain, and private key in a single file.
- Mac
- Windows
- Launch Keychain Access.
- In the Category section, select
My Certificates
. - Find the certificate you want to export and disclose its contents. You’ll see both a certificate and a private key.
- Select both the certificate and the key, and choose File > Export Items.
- From the File Format pop-up menu, choose a file format that your server accepts. Enter a filename in the Save As field, and click Save.
The certificate and key are saved to the location you specified as a text file in the Personal Information Exchange format (a file with a .p12
file extension).
- Download an OpenSSL binary if you do not have one.
This is done at your own risk as these are third-party development tools.
- Convert the developer certificate downloaded in the previous section into a PEM file
openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM
- Generate the P12 file using the PEM file
openssl pkcs12 -export -inkey mykey.key -in developer_identity.pem -out iphone_dev.p12
3. Upload the Certificate to the Developer Console
Next, upload the p12 file to the Developer Console. Select the "Push Notifications" section under the "Optimize tab. Make sure you provide the password that was associated with the p12. Otherwise, Skillz will not be able to send push notifications to your game.
The Skillz SDK for Android uses Firebase Cloud Messaging to power push notifications, so you'll need to set up a Firebase project by following the instructions depending on whether your game is made with Unity or natively.
1. Add Firebase to the Game
- Unity
- Android
Skillz supports Unity Firebase 8.9.0.
Follow Google's instructions on how to Add Firebase to your Unity Project.
Follow Google's instructions on how to Add Firebase to your Android Project. Follow along with Option 1: Add Firebase using the Firebase console
2. Upload the FCM key to Skillz
Go to https://console.firebase.google.com/, and select your project. Select Project Settings via the gear icon next to "Project Overview"
- Select the Service Accounts tab.
- Click "Generate new private key".
- Go to your Skillz developers console and select your application.
- Select the Push Notification tab on your left.
- In the "Android FCM keys" section, paste the contents of the private key file you received in step 2 to one of the blank text fields, and press the "Submit" button.
Test and Verify
You can only test Skillz push notifications on a build with your Skillz environment set to Production.
Allow Push Notifications
Before you can test a push notification, you will need to accept push notifications in-app. Run your application on a device. Start Skillz, and follow through the First Time User Experience until you've completed a match.
Activation
Push Notifications can take up to a day to activate after the Push Notification Certificates have been uploaded and verified on developer console.
- iOS
- Android
At that point you should see a Push pop-up like the following screenshot. Make sure you press "Give Access".
If you complete your match before the other player you should see a Push pop-up like the following screenshot. Otherwise continue playing until you you manage to do so. Make sure you press "Okay".
Send Test Notifications
Test notifications can be sent from the page where you uploaded the push notifications certificate:
Enter the username of the user who you would like to receive the notification and click "Send Test". The user must be logged into the game on a device, and have push notifications enabled in order to receive your test push notification. It may take a few minutes for the user to receive the push notification, which will include a random 6-digit code. Please enter the code into the 2nd field on the screen and click "Verify" to finish the verification process.
If you are not receiving any push notifications, make sure you have enabled notifications for your app in your settings.
- iOS
- Android
Go to Settings > Notifications
, select your app and toggle on "Allow Notifications".
Go to Settings > Notifications > App notifications
, select your app and toggle on the switch.
Troubleshooting
If your game is not receiving notifications, make sure you've done the following:
- iOS
- Android
- If you just uploaded your
.p12
file to the developer console, it can occasionally take some time for your new file to propagate through our system. Please try again in a few hours. - Enabled push notifications for your app ID in your Apple Developer account.
- Generated a push notification certificate.
- Added the certificate to your Keychain.
- Regenerated your provisioning profile.
- Updated your XCode project with the regenerated provisioning profile.
- Added the "Push Notifications" capability in your XCode project.
- Set the Skillz environment to Production in your app.
- Provided the correct password for your
.p12
to the Developer Console. - Gave your app permission to receive push notifications on the iOS device.
- Sending test notifications may not work immediately as it can take up to 24 hours for your FCM key to be transferred to our push notification backend.
- Gave your app permission to receive push notifications on the device.
- Set the Skillz environment to Production in your app.
Please contact us, if you need further assistance.