All Collections
Using the Portal
Push notification configuration - iOS
Push notification configuration - iOS

unity, mobile notifications, push notification, p12

Jason Liang avatar
Written by Jason Liang
Updated over a week ago

This article will walk you through the steps of setting up push notifications (iOS) with brainCloud.


  • You have an Apple developer account

  • You have a physical iOS 10 and above testing device

Step 1: Create an application on Unity editor

  • Open Unity hub and create a new project.

  • Download and import the latest brainCloud client Unity package to this project. Once imported the plugin correctly, you will find the brainCloud tab appears on the editor menu.

  • Download and import the latest Mobile Notifications package from package manager to your project.

  • Set up mobile notifications for iOS from edit->project settings

  • Open brainCloud setting from the tab, select or create a brainCloud back-end app linked to your project.

  • Create some basic functional UI elements in your project and link the code behind them as the following image.

  • Functions and its code that linked behind the button [Register device token] are similar to below. Once authenticate end-user with their brainCloud account, from the Authorization request, retrieve the device token and pass it to brainCloud device token register method -- RegisterPushNotificationDeviceToken()

    IEnumerator RequestAuthorization()
var authorizationOption = AuthorizationOption.Alert | AuthorizationOption.Badge;
using (var req = new AuthorizationRequest(authorizationOption, true))
while (!req.IsFinished)
yield return null;
string res = "\n RequestAuthorization:";
res += "\n finished: " + req.IsFinished;
res += "\n granted: " + req.Granted;
res += "\n error: " + req.Error;
res += "\n deviceToken: " + req.DeviceToken;
Debug.Log("debug inside ienumerator the res: "+ res);
_bc.PushNotificationService.RegisterPushNotificationDeviceToken(req.DeviceToken, authSuccess_BCcall, authError_BCcall);

//click register token button
public void RegisterDeviceToken()
  • Finish the rest methods and callbacks code in your script.

  • Click Build Settings from Unity File tab, switch platform to iOS.

  • Set up project Bundle Identifier and target SDK via Player Settings .

  • Click Build and Run, then create a folder to save this Xcode project on your local storage.

Step 2: Setup project on Xcode editor

  • Once Xcode is opened from the above step, open Signing & Capabilities from your target device in the project panel.

  • Click Automatically manage signing checkbox and enable it.

  • Then, login into your team and provisioning profile.

Step 3: Create and download notification p12 file from your apple account

  • You should find your project identifier is created from the above step on the list of Identifiers under the Certificates, Identifiers & Profiles section of your apple developer account.

  • Click it and scroll down to Pushnotification row, then click configure.

  • Click create certificate under an environment type ( you will use the same environment type when configuring push notification settings on brainCloud), then click continue to create a CSR file.

  • You will be asked to upload a certificate then.

  • Open Keychain from your Mac, click the Certificate Assistant menu and select Request a Certificate From a Certificate Authority under the Keychain Access tab.

  • Fill out the fields and select Saved to disk, then click Continue.

  • Choose a folder to save this cert.

  • This cert file will be saved to your local folder.

  • Go back to your apple account page, upload this signing request file there, and hit Continue.

  • Click download to save this certificate.

  • Go back to your Keychain app again, drag this certificate file from the above step to the certificates section of the login keychains

  • You will find the push services certificate is added to the certificates list.

  • Right-click the push services certificate and export it to local storage.

  • Enter your login password and click continue

  • Click Save.

  • Leave a password for this file, you will need this password later when configuring push notification on your brainCloud portal.

Step 4: Upload p12 certificate file to your app on brainCloud portal

  • Go to Design | Notifications | Settings page, click edit settings under the Actions column of Apple, upload the p12 certificate you get from the previous steps.

  • Enter the p12 file protect-password and select the certificate environment accordingly. It should match the type when you created this certificate from your apple account.

  • Set an expiration day.

Step 5: Run app via Xcode

  • Go back to Xcode editor

  • Connect your test device to Xcode and run this project.

  • Click Allow when asking for notification authorization.

  • Authenticate an end-user and register device token with brainCloud.

  • Check the sent notification.

  • Check the registered device token of the end-user from brainCloud portal.

  • Test to send notifications from brainCloud portal to your device.

Did this answer your question?