我需要在我的 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)
}
}