项目作者: google

项目描述 :
Android library for sending fastboot commands from an Android device to a device running fastboot.
高级语言: Kotlin
项目地址: git://github.com/google/fastboot-mobile.git
创建时间: 2018-06-08T18:08:51Z
项目社区:https://github.com/google/fastboot-mobile

开源协议:Apache License 2.0

下载


Fastboot Mobile

Android library for sending fastboot commands from an Android device to a device running fastboot.

Only supports fastboot over USB On-The-Go (OTG) connections.

This is NOT an officially supported Google product.

Usage

List Attached Fastboot Devices

  1. // Includes connected devices.
  2. val deviceIds : List<DeviceId> = FastbootDeviceManager.getAttachedDeviceIds()

List Connected Fastboot Devices

  1. val deviceIds : List<DeviceId> = FastbootDeviceManager.getConnectedDeviceIds()

Connect to a Fastboot Device

  1. // typealias DeviceId = String
  2. FastbootDeviceManager.addFastbootDeviceManagerListener(
  3. object : FastbootDeviceManagerListener() {
  4. override fun onFastbootDeviceAttached(deviceId: DeviceId) {
  5. Log.d("Device attached: $deviceId")
  6. }
  7. override fun onFastbootDeviceDetached(deviceId: DeviceId) {
  8. Log.d("Device detached: $deviceId")
  9. }
  10. override fun onFastbootDeviceConnected(deviceId: DeviceId, deviceContext: FastbootDeviceContext) {
  11. // Do some fastboot stuff...
  12. val response = deviceContext.sendCommand(FastbootCommand.getVar("current-slot"))
  13. val bootSlot = response.data
  14. Log.d("Device $deviceId with slot $bootSlot.")
  15. }
  16. })
  17. FastbootDeviceManager.connectToDevice(/* Serial Number */ "abc123")