- Jun 6, 2020
- 11,517
- 4,383
Better implementation based on B4XPages:
Updated implementation, based on B4XPages of
Tutorial was rewritten in April 2018.
We will create a chat example between two Android devices.
All the non-UI code is implemented in a class named BluetoothManager. It is initialized in Service_Create of the starter service.
It is always better to implement communication related code in a service or a class initialized from a service. This way the communication state is not affected by the activities more complicated state.
The activities call the class methods directly. Calling the activities subs is done with CallSub. Remember that CallSub doesn't do anything if the activity is paused.
The first activity, the main activity, shows two buttons. One for searching other devices and one for listening for connections.
Searching other devices requires a "dangerous" permissions (see the runtime permissions tutorial for...
برای دیدن لینک ها باید ثبت نام کنید
Updated implementation, based on B4XPages of
برای دیدن لینک ها باید ثبت نام کنید
. The code is much simpler compared to the previous example. Note that you can call Serial.Listen without making the device discoverable. This is...
برای دیدن تصاویر باید ثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید
Tutorial was rewritten in April 2018.
We will create a chat example between two Android devices.
All the non-UI code is implemented in a class named BluetoothManager. It is initialized in Service_Create of the starter service.
It is always better to implement communication related code in a service or a class initialized from a service. This way the communication state is not affected by the activities more complicated state.
The activities call the class methods directly. Calling the activities subs is done with CallSub. Remember that CallSub doesn't do anything if the activity is paused.
The first activity, the main activity, shows two buttons. One for searching other devices and one for listening for connections.
Searching other devices requires a "dangerous" permissions (see the runtime permissions tutorial for...
برای دیدن لینک ها باید ثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید