Antilost with smart watch

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
User avatar
Lyriss113
Posts: 10
Joined: 06 Mar 2018 14:35

Antilost with smart watch

Post by Lyriss113 » 21 Sep 2018 12:15

Hello Automagic community,

I bought a smart watch to use it as Phone antilost thinking that this feature would help me to not forget my phone everywhere, the problem is that feature is useless because the watch notify me after a very long time ( and a long distance too ).

My first thought is to use something that measure the strength of Bluetooth signal, if it's below certain value it disconnect the smart watch and then i get the notification.

Any idea how can i do that ?

Note : the smart watch is a Huwawei B3 lite ( Bluetooth headset and watch )

Thanks

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Antilost with smart watch

Post by Desmanto » 22 Sep 2018 05:26

Never use smartwatch, only mi band 2. Does the B3 Lite has the BLE feature? Measuring signal only available for BLE devices. And it is also not efficient way to do it, since you have do it in periodic timer. Set the interval too high, you face the same long time notify. Set the interval too low, phone consume more battery. It seem not a efficient way to do it.

The better way to do it is to check the bluetooth device disconnected trigger. Use this and coupled with delay of several seconds before notifiying. Usually smartwatch bluetooth has limited range, 3 meters above will be disconnected. Add a buffer sleep about 5-10 seconds before notifiying. If the smartwatch reconnected within this time, it will trigger another bluetooth device connected and stop the sleep and stop notifiying. So reducing the flapping connection.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Lyriss113
Posts: 10
Joined: 06 Mar 2018 14:35

Re: Antilost with smart watch

Post by Lyriss113 » 22 Sep 2018 20:02

Thanks Desmanto. The huwawei B3 has a pretty good range. Beside it seems that there some internal delay before the watch vibrate to notify disconnection. That's what make the build in anti lost not useful at all. Sometime i walk more that 50m and run my car and the watch didn't react.
But it vibrate the moment i disconnect it from the phone..thus the idea to measure Bluetooth strengh and if it fall uder certain value i the phone turnoff Bluetooth and the wat h will vibrate.
I hope there is a way to have this mesure of at least a third party that can do it and automagic take care of the rest.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Antilost with smart watch

Post by Desmanto » 23 Sep 2018 11:38

You can try then using condition Bluetooth LE device available, see if it can find the watch. It will supply you with the rssi as the signal. put condition debug dialog after it to check the value. The value is in dBm, hence negative. So -42 is stronger than -84.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Lyriss113
Posts: 10
Joined: 06 Mar 2018 14:35

Re: Antilost with smart watch

Post by Lyriss113 » 27 Sep 2018 16:10

Thanks Desmanto,
Automagic don't detect the watch as BLE :cry: .
I've been looking on the internet for a solution to have the RSSI value for connected device, unfortunalty i think that there is no way to do it.

I am not good with Android programming, but i wonder since the watch is connected to the app there is maybe a way to intercept the communication ( with general broadcast for example ).

as I explain before I bought the watch only to use it as antilost for my phone, but this watch has a very long range and it don't serve the purpuse, I want something that notify me if I am away from my phone by few meters.

I tryed also make a flow that disconect and connect the watch every 5s then test if the watch is connected ( assuming that if the watch if far enough there will be a latence time to reconnect but i think that is a battery and ressource consuming.

So any other Idea how can I make this work ?

Thanks.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Antilost with smart watch

Post by Desmanto » 27 Sep 2018 17:42

Unfortunately, with out the BLE protocol, there is no way to detect the RSSI. There is probably some app can detect the raw bluetooth data. But I don't think you can intercept it just like that, and most likely it needs root.

If the app produce some events, or broadcast; then it is possible to catch the broadcast and act on it. You will need PC + adb, use dumpsys to capture the history broadcast.

Code: Select all

adb shell dumpsys activity broadcasts history > history.txt
Then open the history.txt, search for the app broadcast. It is a very painful process, as you need to read one by one. And it doesn't guarantee if the app has the broadcast that you can use.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Lyriss113
Posts: 10
Joined: 06 Mar 2018 14:35

Re: Antilost with smart watch

Post by Lyriss113 » 17 Nov 2018 15:39

Thanks Desmanto. You are helpful as usual.

Post Reply