言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

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

Appleのプッシュサービスを介して、プロバイダから指定 されたタイプのリモート通知を受け取れるよう登録します

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