Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用GCM的Azure推送通知_Android_Azure_Xamarin - Fatal编程技术网

Android 使用GCM的Azure推送通知

Android 使用GCM的Azure推送通知,android,azure,xamarin,Android,Azure,Xamarin,如何从特定标签中注销一个设备。 我正在发送带有标签的通知。它工作正常。但即使我取消注册,它仍然会收到通知 protected async void HandleRegistration(Context context, Intent intent) { string registrationId = intent.GetStringExtra("registration_id"); string error = intent.G

如何从特定标签中注销一个设备。 我正在发送带有标签的通知。它工作正常。但即使我取消注册,它仍然会收到通知

protected async void HandleRegistration(Context context, Intent intent)
        {


            string registrationId = intent.GetStringExtra("registration_id");
            string error = intent.GetStringExtra("error");
            string unregistration = intent.GetStringExtra("unregistered");


//Retriving string From The Memory

            ISharedPreferences preferences = PreferenceManager.GetDefaultSharedPreferences(context);
            string groupname = preferences.GetString ("GroupName","");


            var nMgr = (NotificationManager)GetSystemService (NotificationService);

            if (!String.IsNullOrEmpty (registrationId)) {
                NativeRegistration = await Hub.RegisterNativeAsync (registrationId,new[] {groupname.ToString()});

                var notificationNativeRegistration = new Notification (Resource.Drawable.notification, "Your Device Successfully Registered To "+groupname.ToString());
                var pendingIntentNativeRegistration = PendingIntent.GetActivity (this, 0, new Intent (this, typeof(MainActivity)), 0);

                notificationNativeRegistration.SetLatestEventInfo (this, "Device ID ", NativeRegistration.RegistrationId, pendingIntentNativeRegistration);
                nMgr.Notify (_messageId, notificationNativeRegistration);
                _messageId++;
            }
            else if (!String.IsNullOrEmpty (error)) {
                var notification = new Notification (Resource.Drawable.notification, "Gcm Registration Failed.");
                var pendingIntent = PendingIntent.GetActivity (this, 0, new Intent (this, typeof(MainActivity)), 0);
                notification.SetLatestEventInfo (this, "Gcm Registration Failed", error, pendingIntent);
                nMgr.Notify (_messageId, notification);
                _messageId++;
            }
            else if (!String.IsNullOrEmpty (unregistration)) {
                if (NativeRegistration != null)
                    await Hub.UnregisterAsync (NativeRegistration);

                var notification = new Notification (Resource.Drawable.notification, "Unregistered successfully.");
                var pendingIntent = PendingIntent.GetActivity (this, 0, new Intent (this, typeof(MainActivity)), 0);
                notification.SetLatestEventInfo (this, "MyIntentService", "Unregistered successfully.", pendingIntent);
                nMgr.Notify (_messageId, notification);
                _messageId++;
            }
        }

我想知道如何注销以前标记为的设备?

您必须在Microsoft Visual Studio中使用service Bus Explorer()来查看所有已注册的设备。您还可以从已注册设备列表中取消注册设备

异常:远程服务器返回错误:(401)未经授权。此操作需要管理索赔。TrackingId:bf65054d-036a-467e-b3e2-1a8d34ed8ff7_G7,时间戳:1/11/2015 10:00:19 Am非常感谢jahanzaib aslam,但我需要通过自身编码来注销。因为它必须是动态的,对吧?我不认为你可以用编码来实现。这在Azure中是一个问题