More Related Content
Similar to JAZUG 3周年LT (20)
JAZUG 3周年LT
- 2. 通知ハブとは
サービス バスメッセージングの拡張
–Windows Azure SDK 2.1 の名前空間は“Microsoft.ServiceBus”
外部のアプリケーションからプッシュ通知
–プッシュ通知だけ利用したい場合に便利
–数百万台のデバイスに対して同時配信を実現
様々なデバイスをサポート(Windows Store, iOS, Android, …)
タグ付けによる配信先のフィルタリング
– 受信者があらかじめ受信したいタグを登録
– 送信者は適宜タグを付加して配信
- 5. サーバ側のコード例
string connectionString = ServiceBusConnectionStringBuilder
.CreateUsingSharedSecret(
new Uri("sb://xxxx.servicebus.windows.net/"),"owner",
“Enter your shared secret key");
var hubClient = NotificationHubClient.CreateClientFromConnectionString
(connectionString, “hubname");
hubClient.SendTemplateNotificationAsync(
CreateToastImageAndText02(“画像のURL",
“キャプション”, “メッセージ本文" ));
- 6. クライアント(ストアアプリ)側のコード例
var cn = ConnectionString.CreateUsingSharedSecret(
new Uri("sb://tatsuakisb.servicebus.windows.net/"), "owner",
" Enter your shared secret key ");
NotificationHub notificationHub = new NotificationHub(“hubname", cn);
(中略)
var channel = await PushNotificationChannelManager.
CreatePushNotificationChannelForApplicationAsync();
List<string> Tags = new List<string> { "Windows8", "Japan" };
await notificationHub.RegisterTemplateAsync(channel.Uri,
テンプレートのインスタンスを指定, “テンプレート名", Tags);