Hello,
I’am trying to communicate with my port USB but I have a problem with the method requestPermission() from the class UsbManager. the method requestPermission is not recognyzed whereas in the datasheet it does exist. (datasheet : UsbManager | Android Developers)
this in my code :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)//USB var m_device :UsbDevice? = null var mUsbReceiver = UsbReceiver() var ACTION_USB_PERMISSION :String = "com.android.example.USB_PERMISSION"; var mUsbManager = getSystemService(Context.USB_SERVICE); var mPermissionIntent = PendingIntent.getBroadcast(this, 0, Intent(ACTION_USB_PERMISSION), 0); var filter :IntentFilter = IntentFilter(ACTION_USB_PERMISSION) registerReceiver(mUsbReceiver, filter); mUsbManager.requestPermission(m_device, mPermissionIntent); }
to create an instance of the class UsbManager we use the method getSystemService. But I don’t understand why the method is not recognyzed
thank you for your help