Android Question BLE Central example does not run

grafsoft

Well-Known Member
Licensed User
Longtime User
Hi,

no success with my Xiaomi Band 6, working well with the app MiFit.

The log, I do not know what else I can send to facilitate the analysis:

B4X:
Logger verbunden mit:  samsung SM-A725F
--------- beginning of crash
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
StateChanged: 12
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
StateChanged: 12
** Activity (main) Pause, UserClosed = true **
Logger verbunden mit:  samsung SM-A725F
--------- beginning of crash
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
StateChanged: 12
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
StateChanged: 12
** Activity (main) Pause, UserClosed = true **
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (activity_permissionresult)
running waiting messages (1)
** Activity (main) Resume **

(Erel sorry for my last post. I could explain, but thread closed ...)
 

grafsoft

Well-Known Member
Licensed User
Longtime User
I did.

B4X:
Logger verbunden mit:  samsung SM-A725F
--------- beginning of crash
--------- beginning of main
--------- beginning of system
Copying updated assets files (9)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**

The program stops at this line in Sub btnScan_Click
B4X:
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
In release mode it crashes as soon as I touch the button "Scan & connect",
 
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you for your help, here it is:

B4X:
Logger verbunden mit:  samsung SM-A725F
--------- beginning of crash
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
java.lang.Exception: Sub activity_permissionresult was not found.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:219)
    at anywheresoftware.b4a.BA$2.run(BA.java:387)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8633)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
java.lang.Exception: Sub activity_permissionresult was not found.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:219)
    at anywheresoftware.b4a.BA$2.run(BA.java:387)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8633)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
 
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you, much better, no crash.But after a few seconds (with red dots running in circles) I get "not connected". Device works. What can I do?
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
Usually BLE app needs fine location be ON

Remove the app
Turn fine location ON
Install the app (shoould ask for permissions)
Try to scan&connect
 
Upvote 1

f0raster0

Well-Known Member
Licensed User
Longtime User
Hi again..
i just tested the ble example

.. after a few seconds...I get "not connected"...
What can I do?
make sure location is ON
20220113_234559.jpg
 
Last edited:
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Hi,

I think you mean Google location precision (sorry, my Android 12 speaks German). It is always ON.

De-installed, re-installed, still no success.

Thanks
Peter
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
Hi,

I think you mean Google location precision (sorry, my Android 12 speaks German). It is always ON.

De-installed, re-installed, still no success.

Thanks
Peter
Are you trying the ble example as is, rigth?

My Android is 11, then don't know if android 12 is the issue.

Can you please post the new logs when you are trying: scan&connect

Edit: make sure the app MiFit is not running..
 
Last edited:
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Runs without MyFit! You are my hero! Do you by any chance know by heart how to get the heart rate? But do not waste your time, there are numerous examples :)
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
Runs without MyFit! You are my hero! Do you by any chance know by heart how to get the heart rate? But do not waste your time, there are numerous examples :)
super.. start a new question and post the log..
there we can make working the heart rate :)
 
Upvote 1
Solution

grafsoft

Well-Known Member
Licensed User
Longtime User
Sorry, not completely solved: Sometimes connecting works, sometimes (most of the time) not:

B4X:
Logger verbunden mit:  samsung SM-A725F
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
Found: , 4A:FF:6E:16:CB:76, RSSI = -83, (MyMap) {1=[B@a14f380, 10=[B@21cddb9, -1=[B@7eef5fe, 0=[B@26515f}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -83, (MyMap) {-1=[B@b95c7ac, 0=[B@ca49c75}
connecting
Found: , 51:42:E5:0A:8C:DD, RSSI = -94, (MyMap) {1=[B@140740a, 10=[B@588a47b, -1=[B@f6db298, 0=[B@7af8af1}
connecting
Discovering services.
Disconnected
Connected
Disconnected
Found: , 4A:FF:6E:16:CB:76, RSSI = -84, (MyMap) {1=[B@be5f3ba, 10=[B@d07a26b, -1=[B@97ef1c8, 0=[B@1681261}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -82, (MyMap) {-1=[B@6ef9186, 0=[B@5fbfa47}
connecting
Discovering services.
Connected
Disconnected
Found: , 00:77:89:30:72:D6, RSSI = -80, (MyMap) {-1=[B@682bf6a, 0=[B@1f9fc5b}
connecting
Found: Mi Smart Band 6, E0:84:27:16:FA:1B, RSSI = -54, (MyMap) {1=[B@bb65cf8, -1=[B@cc955d1, 9=[B@a856836, 2=[B@520337, 0=[B@37050a4}
connecting
Disconnected
Disconnected
Found: , DC:D9:1E:AD:26:77, RSSI = -100, (MyMap) {-1=[B@5eeb24b, 0=[B@1f6f428}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -78, (MyMap) {-1=[B@37a5541, 0=[B@2564ae6}
connecting
Disconnected
Disconnected
Found: , 77:72:50:71:6B:6A, RSSI = -92, (MyMap) {3=[B@8064635, 22=[B@60e3aca, -1=[B@c34c43b, 0=[B@6e3b758}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -81, (MyMap) {-1=[B@6e210b1, 0=[B@93d3996}
connecting
Disconnected
Disconnected
Found: , BC:7E:8B:C3:53:0B, RSSI = -100, (MyMap) {-1=[B@212ea7a, 0=[B@9db322b}
connecting
Found: , 77:72:50:71:6B:6A, RSSI = -92, (MyMap) {3=[B@3dfa688, 22=[B@278821, -1=[B@6d53446, 0=[B@2d8c607}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -77, (MyMap) {-1=[B@30ca334, 0=[B@453855d}
connecting
Disconnected
Disconnected
Disconnected
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
Sorry, not completely solved: Sometimes connecting works, sometimes (most of the time) not:

B4X:
Logger verbunden mit:  samsung SM-A725F
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
Found: , 4A:FF:6E:16:CB:76, RSSI = -83, (MyMap) {1=[B@a14f380, 10=[B@21cddb9, -1=[B@7eef5fe, 0=[B@26515f}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -83, (MyMap) {-1=[B@b95c7ac, 0=[B@ca49c75}
connecting
Found: , 51:42:E5:0A:8C:DD, RSSI = -94, (MyMap) {1=[B@140740a, 10=[B@588a47b, -1=[B@f6db298, 0=[B@7af8af1}
connecting
Discovering services.
Disconnected
Connected
Disconnected
Found: , 4A:FF:6E:16:CB:76, RSSI = -84, (MyMap) {1=[B@be5f3ba, 10=[B@d07a26b, -1=[B@97ef1c8, 0=[B@1681261}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -82, (MyMap) {-1=[B@6ef9186, 0=[B@5fbfa47}
connecting
Discovering services.
Connected
Disconnected
Found: , 00:77:89:30:72:D6, RSSI = -80, (MyMap) {-1=[B@682bf6a, 0=[B@1f9fc5b}
connecting
Found: Mi Smart Band 6, E0:84:27:16:FA:1B, RSSI = -54, (MyMap) {1=[B@bb65cf8, -1=[B@cc955d1, 9=[B@a856836, 2=[B@520337, 0=[B@37050a4}
connecting
Disconnected
Disconnected
Found: , DC:D9:1E:AD:26:77, RSSI = -100, (MyMap) {-1=[B@5eeb24b, 0=[B@1f6f428}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -78, (MyMap) {-1=[B@37a5541, 0=[B@2564ae6}
connecting
Disconnected
Disconnected
Found: , 77:72:50:71:6B:6A, RSSI = -92, (MyMap) {3=[B@8064635, 22=[B@60e3aca, -1=[B@c34c43b, 0=[B@6e3b758}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -81, (MyMap) {-1=[B@6e210b1, 0=[B@93d3996}
connecting
Disconnected
Disconnected
Found: , BC:7E:8B:C3:53:0B, RSSI = -100, (MyMap) {-1=[B@212ea7a, 0=[B@9db322b}
connecting
Found: , 77:72:50:71:6B:6A, RSSI = -92, (MyMap) {3=[B@3dfa688, 22=[B@278821, -1=[B@6d53446, 0=[B@2d8c607}
connecting
Found: , 00:77:89:30:72:D6, RSSI = -77, (MyMap) {-1=[B@30ca334, 0=[B@453855d}
connecting
Disconnected
Disconnected
Disconnected
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
add a filter to connect to your module.
 
Upvote 0
Top