Fork自Google开源的Android串口通信Demo,修改成Android Studio项目
Fork自Google开源的Android串口通信Demo,修改成Android Studio项目
Fork自Google开源的Android串口通信Demo,修改成Android Studio项目
This lib is a fork of the Android serial port communication Demo open sourced by Google.
Gradle
添加依赖:
Add the dependency:
allprojects {
repositories {
...
jcenter()
mavenCentral() // since 2.1.3
}
}
dependencies {
// 传统4KB内存页面版本
implementation 'com.licheedev:android-serialport:2.1.4'
// 适配16KB页面版本,https://developer.android.google.cn/guide/practices/page-sizes?hl=zh-cn
implementation 'com.licheedev:android-serialport:2.1.5'
}Import
import android.serialport.SerialPort;su path
In order to read/write to a serial port in Android you'll need su binary installed on device (this can be done by rooting the device). Usually Android devices that has the ability to communicate with serial ports have su installed on the default path "/system/bin/su". To change this use:
// su默认路径为 "/system/bin/su"
// The default path of su is "/system/bin/su"
// 可通过此方法修改
// If the path is different then change it using this
SerialPort.setSuPath("/system/xbin/su");Usage
…实现方式参考
Implementation reference
No open issues yet, or sync has not completed.