This commit is contained in:
geeksville 2020-06-08 14:04:56 -07:00
parent 303fb86aa6
commit 420b718b11
4 changed files with 125 additions and 45 deletions

View file

@ -13,6 +13,8 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageManager
import android.hardware.usb.UsbDevice
import android.hardware.usb.UsbManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
@ -427,6 +429,11 @@ class MainActivity : AppCompatActivity(), Logging,
// We now wait for the device to connect, once connected, we ask the user if they want to switch to the new channel
}
if (appLinkAction == UsbManager.ACTION_USB_ACCESSORY_ATTACHED) {
val device: UsbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE)!!
errormsg("Handle USB device attached! $device")
}
}
override fun onDestroy() {