Code example for UsbManager

Methods: requestPermission

0
			Toast.makeText(this, "No TinyG USB host devices attached!",
					Toast.LENGTH_SHORT).show();
		} else { 
			PendingIntent mPermissionIntent = PendingIntent.getBroadcast(this,
					0, new Intent(ACTION_USB_PERMISSION), 0);
			mUsbManager.requestPermission(deviceFTDI, mPermissionIntent);
		} 
	} 
 
	// Handle data from the USB endpoint in a separate thread. 
	protected class ListenerTask extends AsyncTask<Integer, String, Void> {
		@Override 
		protected Void doInBackground(Integer... params) {
			byte[] inbuffer = new byte[USB_BUFFER_SIZE];
			byte[] linebuffer = new byte[1024];
			int cnt, idx = 0;
			try { 
				while (!isCancelled()) {
					if ((cnt = conn.bulkTransfer(epIN, inbuffer, USB_BUFFER_SIZE, 0)) < 2) {
						Log.e(TAG, "Bulk read failed");
						break;