0
私のフォームアプリケーションにプッシュ通知を統合しようとしました。 Azureメッセージングコンポーネントは、これを達成するために使用されます。 以下は私が使用しているコードです。私はRegisteredForRemoteNotifications
メソッドへのトリガーを取得しています。しかし、RegisterNativeAsync
メソッドは、仕事をしているようです。XamarinフォームでAzureプッシュ通知サービスを購読する
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
{
var push = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
new NSSet());
UIApplication.SharedApplication.RegisterUserNotificationSettings(push);
UIApplication.SharedApplication.RegisterForRemoteNotifications();
}
else
{
const UIRemoteNotificationType not = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(not);
}
}
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
Hub = new SBNotificationHub(conStirng, NotifHubPath);
Hub.UnregisterAllAsync(deviceToken, (error) =>
{
//Get device token
var id = deviceToken.ToString();
var tag = "username";
var tags = new List<string> { tag };
Hub.RegisterNativeAsync(id, new NSSet(tags.ToArray()), (errorCallback) =>
{
if (errorCallback != null)
{
//Log to output
}
});
});
}
私はここで間違っていますか? Register機能が成功したか失敗したかを確認する方法はありますか?
Nullは成功ですか? – TutuGeorge
エラーがないことを意味します。従って成功。 – Aravind