Legacy Documentation: Version 4.6.2
Language: English
  • C#
  • JS
  • Boo

Script language

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

NotificationServices.RegisterForRemoteNotificationTypes

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function RegisterForRemoteNotificationTypes(notificationTypes: RemoteNotificationType): void;
public static void RegisterForRemoteNotificationTypes(RemoteNotificationType notificationTypes);
public 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.

Note: calling this method will set the requested notification types for both local and remote notifications, overriding any previous calls.

	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; } } }