Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

NotificationServices.RegisterForRemoteNotificationTypes

static function RegisterForRemoteNotificationTypes(notificationTypes: RemoteNotificationType): void;
static void RegisterForRemoteNotificationTypes(RemoteNotificationType notificationTypes);
static def RegisterForRemoteNotificationTypes(notificationTypes as RemoteNotificationType) as void

Description

Register to receive remote notifications of the specified types from a provider via Apple Push Service.

After an application registers for the specified remote notification types, the device token is received from Apple Push Service and is available via NotificationServices.deviceToken.

	function Start() {
		NotificationServices.RegisterForRemoteNotificationTypes(RemoteNotificationType.Alert | 
									RemoteNotificationType.Badge | 
									RemoteNotificationType.Sound);
	}

function Update () { if (!tokenSent) { var token : byte[] = NotificationServices.deviceToken; if (token != null) { // send token to a provider var hexToken : String = "%" + System.BitConverter.ToString(token).Replace('-', '%'); new WWW("http://"+address+"/?token="+hexToken); tokenSent = true; } } }