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