/// <summary>
        /// Requests temporary permission for the given package to access the accessory. 
        /// This may result in a system dialog being displayed to the user if permission had not already been granted.
        /// </summary>
        /// <returns>The observable sequence of permission values.</returns>
        /// <param name="manager">The UsbManager system service.</param>
        /// <param name="context">The Context to request the permission from.</param>
        /// <param name="accessory">The UsbAccessory to request permission for.</param>
        public static IObservable<bool> PermissionRequested(this UsbManager manager, Context context, UsbAccessory accessory)
        {
            return Observable.Create<bool> (observer => {
                var usbPermissionReceiver = new UsbAccessoryPermissionReceiver (observer, accessory);
                context.RegisterReceiver (usbPermissionReceiver, new IntentFilter (ACTION_USB_PERMISSION));

                var intent = PendingIntent.GetBroadcast (context, 0, new Intent (ACTION_USB_PERMISSION), 0);
                manager.RequestPermission (accessory, intent);

                return Disposable.Create (() => context.UnregisterReceiver (usbPermissionReceiver));
            });
        }
 public UsbAccessoryPermissionReceiver (IObserver<bool> observer, UsbAccessory accessory)
 {
     this.observer = observer;
     this.accessory = accessory;
 }