*

Push Notification Setup – iOS

Prerequisites

  • Must have an iOS developer account
  • In order to configure brainCloud to send notifications to your iOS app, you will need to provide a p12 certificate file. Follow these steps to create a p12 file for your app.

brainCloud Portal Configuration

  • Log into the brainCloud portal
  • Navigate to “Notifications | Settings” in the design tab for your app
  • Click on the edit button for the Apple notification settings
  • Upload your p12 file and enter the password that was used to create the p12 file into the dialog
  • Notice that once you’ve done that, the type of certificate shows up (production/sandbox) as well as the expiry date

Unity Code Example

// Call this to request notification access via iOS.
UnityEngine.iOS.NotificationServices.RegisterForNotifications(
	UnityEngine.iOS.NotificationType.Alert |
	UnityEngine.iOS.NotificationType.Badge |
	UnityEngine.iOS.NotificationType.Sound);
// After authentication, if you have a deviceToken, send it up to brainCloud.
if (UnityEngine.iOS.NotificationServices.deviceToken != null)
{
	bc.PushNotificationService.RegisterPushNotificationDeviceToken(
		UnityEngine.iOS.NotificationServices.deviceToken,
		in_success,
		in_failure,
		null);
}