ссылке - Notissimus

реклама
msdevcon.ru
#msdevcon
Кросс-платформенные Push уведомления и Geofencing? Нет
ничего проще с сервисами Microsoft
Azure.
Денис Кретов
{НОТИССИМУС | Технический директор}
40+ клиентов
Интернетмагазинов
500К+
установок
Десятки тысяч
Pushуведомлений
ежедневно
Клиентское
устройство
Служба
уведомлений
(Notification
Service)
Сервер
Приложений
(Mobile
Backend)
iOS
Windows 8
Сервер
приложений
Windows Phone GoogleAndroid
APNs
Azure Notification Hub
WNS
MPNS
GSM
windows phone notification settings (mpns)
apple notification settings
google cloud messaging settings
//регистрация в Apple Notification Service.
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
…
//Если регистрация в Apple Notification Service прошла успешно
public override void RegisteredForRemoteNotifications(UIApplication application, NSData
deviceToken)
{
…
//регистрация в Azure Hub
Hub.RegisterNativeAsync(deviceToken, tags, (errorCallback) => {
…
});
}
//регистрация в Mobile Phone Notification Service.
var channel = await
PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
//Подключение к Azure
MobileServiceClient msdevconfClient = new MobileServiceClient(
"https://*.azure-mobile.net/", “SecurityKey");
//регистрация channel.Uri в Azure
await App.msdevconfClient.GetPush().RegisterNativeAsync(channel.Uri);
Ограничения
iOS – 256 bytes;
Android – 1024 bytes;
Windows Phone – 3Kb;
var hub = NotificationHubClient.CreateClientFromConnectionString(
[ConnectionString], [NotificationHub]);
var alert = string.Format("{{\"aps\":{{\"alert\":\"{0}\"}}}}", text);
await hub.SendAppleNativeNotificationAsync(alert);
var hub = NotificationHubClient.CreateClientFromConnectionString(
[ConnectionString], [NotificationHub]);
var alert = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?><wp:Notification
xmlns:wp=\"WPNotification\"><wp:Toast><wp:Text1>Уведомление</wp:Text1><wp:Te
xt2>{0}</wp:Text2><wp:Toast></wp:Notification>", text);
await hub.SendMpnsNativeNotificationAsync(alert);
База данных
для хранения
статистики
Сводный
отчет
База данных
для хранения
статистики
await hub.SendMpnsNativeNotificationAsync(alert, new
List()<string>{“UniqueGuid”});
protected CLLocationManager _locMgr;
public GeofencingLocationManager(CLCircularRegion clRegion)
{
_locMgr = new CLLocationManager();
//Определяем область geofencing
_locMgr.StartMonitoring(clRegion);
//Указываем события в момент входа в область geofencing
_locMgr.RegionEntered += HandleRegionEntered;
//Указываем события в момент выхода из области geofencing
_locMgr.RegionLeft += HandleRegionLeft;
}
Bluetooth LE
protected CLLocationManager _locMgr;
public GeofencingLocationManager(CLBeaconRegion beaconRegion)
{
_locMgr = new CLLocationManager();
// Указываем beacon
_locMgr.StartMonitoring(beaconRegion);
//Указываем события в момент входа в область beacon
_locMgr.RegionEntered += HandleRegionEntered;
//Указываем события в момент выхода из области beacon
_locMgr.RegionLeft += HandleRegionLeft;
}
Package.appxmanifest
<Capabilities>
<m2:DeviceCapability Name="bluetooth.genericAttributeProfile">
<m2:Device Id="any">
<m2:Function Type="serviceId:ID beacon"/></m2:Device>
</m2:DeviceCapability></Capabilities>
Page.xaml.cs
protected override async void OnNavigatedTo(NavigationEventArgs e) {
foreach (DeviceInformation di in await
DeviceInformation.FindAllAsync(BluetoothLEDevice.GetDeviceSelector())){
BluetoothLEDevice bluetoothLEDevice = await BluetoothLEDevice.FromIdAsync(di.Id);
}
}
Спасибо за внимание!
Денис Кретов
{НОТИССИМУС, Технический директор}
kretov.d@notissimus.com; http://notissimus.com; http://tapki.com
© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of
Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Скачать