当前位置: 首页>>代码示例>>C#>>正文


C# MobileServiceClient.GetPush方法代码示例

本文整理汇总了C#中Microsoft.WindowsAzure.MobileServices.MobileServiceClient.GetPush方法的典型用法代码示例。如果您正苦于以下问题:C# MobileServiceClient.GetPush方法的具体用法?C# MobileServiceClient.GetPush怎么用?C# MobileServiceClient.GetPush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.WindowsAzure.MobileServices.MobileServiceClient的用法示例。


在下文中一共展示了MobileServiceClient.GetPush方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterForRemotePushNotifications

 public void RegisterForRemotePushNotifications(MobileServiceClient client, string channelName)
 {
     // Register for push with Mobile Services
     IEnumerable<string> tag = new List<string>() { channelName };
     var push = client.GetPush();
     push.RegisterNativeAsync(DeviceToken, tag);
 }
开发者ID:pedroccrl,项目名称:Xamarin.Plugins-1,代码行数:7,代码来源:AzureNotifier.cs

示例2: UploadChannel

        public async static void UploadChannel()
        {
            PushNotificationChannel channel;
            try
            {
                channel = await PushNotificationChannelManager
                .CreatePushNotificationChannelForApplicationAsync();

                channel.PushNotificationReceived += channel_PushNotificationReceived;
            }
            catch (Exception)
            {
                // TODO: Do something when Push Notifications are not available?
                return;
            }

            try
            {
                JObject templateBody = new JObject();
                templateBody["body"] = String.Format(@"<toast>
                        <visual>
                            <binding template=""ToastText01"">
                                <text id=""1"">$(message)</text>
                            </binding>
                        </visual>
                        </toast>");

                JObject wnsToastHeaders = new JObject();
                wnsToastHeaders["X-WNS-Type"] = "wns/toast";
                templateBody["headers"] = wnsToastHeaders;

                JObject templates = new JObject();
                templates["MyHealthClinicTemplate"] = templateBody;

                client = new MobileServiceClient(AppSettings.MobileAPIUrl, string.Empty, string.Empty);

                await client.GetPush()
                    .RegisterAsync(channel.Uri, templates);

                // Add a new tag to get only the notification for the default patientId.
                var tags = new JArray();
                tags.Add(AppSettings.DefaultTenantId);

                // Call the custom API '/api/updatetags/<installationid>' with the JArray of tags.
                var response = await client
                    .InvokeApiAsync("updatetags/"
                    + client.InstallationId, tags);

            }
            catch (Exception)
            {
                // Handle Exception
            }
        }
开发者ID:rub8n,项目名称:HealthClinic.biz,代码行数:54,代码来源:PushNotifications.cs

示例3: RegisteredForRemoteNotifications

        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            DeviceToken = deviceToken.Description;
            DeviceToken = DeviceToken.Trim('<', '>').Replace(" ", "");

            MobileServiceClient client = new MobileServiceClient(ApplicationUrl, ApplicationKey);

            string userid = NSUserDefaults.StandardUserDefaults.StringForKey("CrmUserId");
            if (string.IsNullOrEmpty(userid)) return;

            //Tags could be expanded to handle multiple different scenarios
            IEnumerable<string> tags = new List<string>() { userid, "All Users" };
            var push = client.GetPush();
            push.RegisterNativeAsync(DeviceToken, tags);
        }
开发者ID:modulexcite,项目名称:CRMBandNotifications,代码行数:15,代码来源:AppDelegate.cs

示例4: UploadChannel

        public async static void UploadChannel()
        {
            PushNotificationChannel channel;
            try
            {
                channel = await PushNotificationChannelManager
                .CreatePushNotificationChannelForApplicationAsync();

                channel.PushNotificationReceived += channel_PushNotificationReceived;
            }
            catch (Exception)
            {
                // TODO: Do something when Push Notifications are not available?
                return;
            }

            try
            {
                JObject templateBody = new JObject();
                templateBody["body"] = String.Format(@"<toast>
                        <visual>
                            <binding template=""ToastText01"">
                                <text id=""1"">$(message)</text>
                            </binding>
                        </visual>
                        </toast>");

                JObject wnsToastHeaders = new JObject();
                wnsToastHeaders["X-WNS-Type"] = "wns/toast";
                templateBody["headers"] = wnsToastHeaders;

                JObject templates = new JObject();
                templates["MyHealthClinicTemplate"] = templateBody;

                client = new MobileServiceClient(AppSettings.MobileAPIUrl, AppSettings.MobileAPIGateway, string.Empty);

                await client.GetPush()
                    .RegisterAsync(channel.Uri, templates);

            }
            catch (Exception)
            {
                // Handle Exception
            }
        }
开发者ID:geekpivot,项目名称:HealthClinic.biz,代码行数:45,代码来源:PushNotifications.cs

示例5: RegisteredForRemoteNotifications

        public override async void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            try
            {
				// Get & Modify device token
				_deviceToken = deviceToken.Description;
				_deviceToken = _deviceToken.Trim ('<', '>').Replace (" ", "");

				// Instantiate a MobileService Client
                _client = new MobileServiceClient(AppSettings.MobileAPIUrl, AppSettings.MobileAPIUrl, string.Empty);

                // Register for push with your mobile app
                var push = _client.GetPush();
                var notificationTemplate = "{\"aps\":{\"alert\":\"$(message)\"}}";

                JObject templateBody = new JObject();
				templateBody["body"] = notificationTemplate;

                JObject templates = new JObject();
                templates["testApsTemplate"] = templateBody;

				await push.RegisterAsync(_deviceToken, templates);
            }
            catch (Exception e)
            {
                Debug.WriteLine("RegisteredForRemoteNotifications -> exception -> " + e.Message);
            }
        }
开发者ID:geekpivot,项目名称:HealthClinic.biz,代码行数:28,代码来源:AppDelegate.cs

示例6: RegisteredForRemoteNotifications

        public override async void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            try
            {
				// Instantiate a MobileService Client
                _client = new MobileServiceClient(AppSettings.MobileAPIUrl);

                // Register for push with your mobile app
                var push = _client.GetPush();
                var notificationTemplate = "{\"aps\":{\"alert\":\"$(message)\"}}";

                JObject templateBody = new JObject();
				templateBody["body"] = notificationTemplate;

                JObject templates = new JObject();
                templates["testApsTemplate"] = templateBody;

				await push.RegisterAsync(deviceToken, templates);

                // Add a new tag to get only the notification for the default patientId.
                var tags = new JArray();
                tags.Add(AppSettings.DefaultTenantId);

                await _client.InvokeApiAsync("updatetags/" + _client.InstallationId, tags);

            }
            catch (Exception e)
            {
                Debug.WriteLine("RegisteredForRemoteNotifications -> exception -> " + e.Message);
            }
        }
开发者ID:Sirikon,项目名称:HealthClinic.biz,代码行数:31,代码来源:AppDelegate.cs

示例7: AzureNotificationHubService_iOS

		public AzureNotificationHubService_iOS ()
		{
			_mobileServiceClient = new MobileServiceClient (Helpers.Keys.AzureMobileService_URL, Helpers.Keys.AzureMobileService_KEY); 
			_push = _mobileServiceClient.GetPush ();
		}
开发者ID:vackup,项目名称:XFormsPushNotifications,代码行数:5,代码来源:AzureNotificationHubService_iOS.cs


注:本文中的Microsoft.WindowsAzure.MobileServices.MobileServiceClient.GetPush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。