我需要在我的android应用程序中集成套接字移动蓝牙扫描仪。.我尝试了他们在其网站https://docs.socketmobile.com/capture/java/en/latest/getting-started.html中规定的SDK 但没有得到扫描结果。这是我的活动。
ScannerMobileActivity类:AppCompatActivity(){
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_scanner_mobile)
setSupportActionBar(toolbar)
Capture.builder(applicationContext)
.enableLogging(BuildConfig.DEBUG)
.build()
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageEvent(event: DataEvent) {
Log.i(TAG, event.data.string)
//dataSourceView.text = event.data.dataSource.name
textView2.text = event.data.string
}
companion object {
private val TAG : String = MainActivity::class.java.name
}
public override fun onStart() {
super.onStart()
EventBus.getDefault().register(this)
}
public override fun onStop() {
super.onStop()
EventBus.getDefault().unregister(this)
}
}
答案 0 :(得分:0)
您使用的是哪个版本的android?如果是9.0,则可能是:https://docs.socketmobile.com/capture/java/en/latest/android/getting-started.html#targeting-android-28