Listening to the Android service for Bluetooth socket connections.
This connection is felt in a permanent loop, where the command has been received.
This service started and is surrounded by activity with onStart ()
with:
intent.putExtras (b); . GetActivity () startService (intent); GetActivity () BindService (intent, mConnection, reference. BIFAATOOCRT);
Any idea why the main thread is closing?
Because as you said, you have a permanent loop in the main thread if there is no Bluetooth connection , It will wait forever and stall your app Use
runable
thread square and place your Bluetooth service on another thread so that the UI can run until there is no Bluetooth connection.
No comments:
Post a Comment