Location security question
Moderator: Martin
- Autumn-Leigh
- Posts: 67
- Joined: 15 Mar 2018 19:23
- Location: UK
- Contact:
Location security question
Sorry, me again. I have managed to get the WiFi available working, but when it comes to not available, it looks and shuts down every 2 mins when it scans. How can I get it to only do it once when WiFi not available please? - so no WiFi available, locks down, pin on etc, but only does it once until it picks it up up that it's true? ? Thank you
- Attachments
-
- Screenshot_2018-03-18-23-25-49.png (146.66 KiB) Viewed 11080 times
YouTube Channel - https://youtu.be/fui3RO9EmNU
If anyone wants a shoutout, or has a flow they want me to do, be it theirs or a new one, let me know
If anyone wants a shoutout, or has a flow they want me to do, be it theirs or a new one, let me know

Re: Location security question
Oh, you are creating geofencing flow based on wifi availability. I suggest you check against the bssid of your wifi.
make sure it matched with your wifi. There can be possibility someone is trying to mimic your wifi name, but they won't have the same bssid. (they can actually spoof the bssid too, but at least this additional check reduce the risk).
Next is for most geofencing check, it is always more efficient if you use helper/secondary flow that can be turned on/off depends on the need. You can read more at the geofencing thread at my index. In this case, the wifi scan results available is the helper flow to exit state, it should be turned off once it finish its job. Or even more efficient is, this flow should be turned on only after another event happen, wifi disconnected.
Copy the clear PIN part to a new flow, and use another more precise trigger event than doesn't need period scanning, such as wifi connected. When you connect to your home wifi, you are definitely at home already. And this trigger doesn't use up battery as much as the periodic scanning.
You want to make the entering trigger to be precise, (wifi connected) and exit has some time buffer (wifi disconnected > wifi scan result). Probably I will draw the concept later (or maybe share the 3 example flows). It has been asked several times and I never actually share the full concept.
Code: Select all
bssid == 12:34:56:ab:cd:ef
Next is for most geofencing check, it is always more efficient if you use helper/secondary flow that can be turned on/off depends on the need. You can read more at the geofencing thread at my index. In this case, the wifi scan results available is the helper flow to exit state, it should be turned off once it finish its job. Or even more efficient is, this flow should be turned on only after another event happen, wifi disconnected.
Copy the clear PIN part to a new flow, and use another more precise trigger event than doesn't need period scanning, such as wifi connected. When you connect to your home wifi, you are definitely at home already. And this trigger doesn't use up battery as much as the periodic scanning.
You want to make the entering trigger to be precise, (wifi connected) and exit has some time buffer (wifi disconnected > wifi scan result). Probably I will draw the concept later (or maybe share the 3 example flows). It has been asked several times and I never actually share the full concept.
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
- Autumn-Leigh
- Posts: 67
- Joined: 15 Mar 2018 19:23
- Location: UK
- Contact:
Re: Location security question
Please Can you explain what flow i need etc please? Im slightly comfused, Bssid is matched. I also dont stay connected to wifi all the timeDesmanto wrote:Oh, you are creating geofencing flow based on wifi availability. I suggest you check against the bssid of your wifi.make sure it matched with your wifi. There can be possibility someone is trying to mimic your wifi name, but they won't have the same bssid. (they can actually spoof the bssid too, but at least this additional check reduce the risk).Code: Select all
bssid == 12:34:56:ab:cd:ef
Next is for most geofencing check, it is always more efficient if you use helper/secondary flow that can be turned on/off depends on the need. You can read more at the geofencing thread at my index. In this case, the wifi scan results available is the helper flow to exit state, it should be turned off once it finish its job. Or even more efficient is, this flow should be turned on only after another event happen, wifi disconnected.
Copy the clear PIN part to a new flow, and use another more precise trigger event than doesn't need period scanning, such as wifi connected. When you connect to your home wifi, you are definitely at home already. And this trigger doesn't use up battery as much as the periodic scanning.
You want to make the entering trigger to be precise, (wifi connected) and exit has some time buffer (wifi disconnected > wifi scan result). Probably I will draw the concept later (or maybe share the 3 example flows). It has been asked several times and I never actually share the full concept.
YouTube Channel - https://youtu.be/fui3RO9EmNU
If anyone wants a shoutout, or has a flow they want me to do, be it theirs or a new one, let me know
If anyone wants a shoutout, or has a flow they want me to do, be it theirs or a new one, let me know

Re: Location security question
To simplify, you only need 3 flows. Or actually can be 2 only. I am recreating my geofencing flow from a simple wifi connect to something like what I have posted above. But still require time to test it first before sharing it. Will share it after finish testing and it is working perfectly. Basically it is like this.
Entering : Flow 1 - Wifi connected
Check for wifi bssid and if it is one of our wifi AP mac, then continue to execute the main flow (can be turning off lock screen, switching on lamp and etc)
Exiting : Flow 2 - Wifi disconnected and Flow 3 - Wifi scan available.
Flow 2 is almost the same as flow, but it is for disconnected event. But after disconnected, we don't directly execute the Exiting main flow. We give it some buffer time, in case the wifi is reconnected. Sometimes we roam around the house and there are blind spot causing wifi disconnected. We don't want this to turn off our lamp immediately, that's why we give some delay timer. I am testing with 1 minute sleep and loop check for wifi available for 5 times. If after 5 times, our phone can't detect our wifi anymore, that means we are far from house already.
But problem is, if we don't leave the house after the 5 minutes, but we leave after 6 minutes, the wifi disconnected flow already finish. If we leave after that, our exiting main flow won't get executed anymore. That's why after that 5 minutes, I will turn on Flow 3 - Wifi scan available, which will check for wifi avaliability again for the rest of the time. So even If I stay at house for 1 hours after disconnected, as long as it still detect one of my neighbor wifi, I am still near the house. Wifi scan available should consume less energy, as it is already perfomed periodically even if we turn off wifi. (will keep scanning unless we turn on airplane mode). Only when the phone now can't detect the wifi anymore, it will execute the main flow of the exiting part.
If i get connected to my wifi again during these 2 flows execution, flow 1 will stop them and disable the Flow 3 (to preserve a bit battery).
So Entering should be precise (wifi connected), but Exiting should have time buffer delay (wifi disconnected + wifi scan available)
Entering : Flow 1 - Wifi connected
Check for wifi bssid and if it is one of our wifi AP mac, then continue to execute the main flow (can be turning off lock screen, switching on lamp and etc)
Exiting : Flow 2 - Wifi disconnected and Flow 3 - Wifi scan available.
Flow 2 is almost the same as flow, but it is for disconnected event. But after disconnected, we don't directly execute the Exiting main flow. We give it some buffer time, in case the wifi is reconnected. Sometimes we roam around the house and there are blind spot causing wifi disconnected. We don't want this to turn off our lamp immediately, that's why we give some delay timer. I am testing with 1 minute sleep and loop check for wifi available for 5 times. If after 5 times, our phone can't detect our wifi anymore, that means we are far from house already.
But problem is, if we don't leave the house after the 5 minutes, but we leave after 6 minutes, the wifi disconnected flow already finish. If we leave after that, our exiting main flow won't get executed anymore. That's why after that 5 minutes, I will turn on Flow 3 - Wifi scan available, which will check for wifi avaliability again for the rest of the time. So even If I stay at house for 1 hours after disconnected, as long as it still detect one of my neighbor wifi, I am still near the house. Wifi scan available should consume less energy, as it is already perfomed periodically even if we turn off wifi. (will keep scanning unless we turn on airplane mode). Only when the phone now can't detect the wifi anymore, it will execute the main flow of the exiting part.
If i get connected to my wifi again during these 2 flows execution, flow 1 will stop them and disable the Flow 3 (to preserve a bit battery).
So Entering should be precise (wifi connected), but Exiting should have time buffer delay (wifi disconnected + wifi scan available)
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
- Autumn-Leigh
- Posts: 67
- Joined: 15 Mar 2018 19:23
- Location: UK
- Contact:
Re: Location security question
What about just wifi scan? as I dont keep my wifi on all the timeDesmanto wrote:To simplify, you only need 3 flows. Or actually can be 2 only. I am recreating my geofencing flow from a simple wifi connect to something like what I have posted above. But still require time to test it first before sharing it. Will share it after finish testing and it is working perfectly. Basically it is like this.
Entering : Flow 1 - Wifi connected
Check for wifi bssid and if it is one of our wifi AP mac, then continue to execute the main flow (can be turning off lock screen, switching on lamp and etc)
Exiting : Flow 2 - Wifi disconnected and Flow 3 - Wifi scan available.
Flow 2 is almost the same as flow, but it is for disconnected event. But after disconnected, we don't directly execute the Exiting main flow. We give it some buffer time, in case the wifi is reconnected. Sometimes we roam around the house and there are blind spot causing wifi disconnected. We don't want this to turn off our lamp immediately, that's why we give some delay timer. I am testing with 1 minute sleep and loop check for wifi available for 5 times. If after 5 times, our phone can't detect our wifi anymore, that means we are far from house already.
But problem is, if we don't leave the house after the 5 minutes, but we leave after 6 minutes, the wifi disconnected flow already finish. If we leave after that, our exiting main flow won't get executed anymore. That's why after that 5 minutes, I will turn on Flow 3 - Wifi scan available, which will check for wifi avaliability again for the rest of the time. So even If I stay at house for 1 hours after disconnected, as long as it still detect one of my neighbor wifi, I am still near the house. Wifi scan available should consume less energy, as it is already perfomed periodically even if we turn off wifi. (will keep scanning unless we turn on airplane mode). Only when the phone now can't detect the wifi anymore, it will execute the main flow of the exiting part.
If i get connected to my wifi again during these 2 flows execution, flow 1 will stop them and disable the Flow 3 (to preserve a bit battery).
So Entering should be precise (wifi connected), but Exiting should have time buffer delay (wifi disconnected + wifi scan available)
YouTube Channel - https://youtu.be/fui3RO9EmNU
If anyone wants a shoutout, or has a flow they want me to do, be it theirs or a new one, let me know
If anyone wants a shoutout, or has a flow they want me to do, be it theirs or a new one, let me know

Re: Location security question
Yes it can be used too. But you have to pair it with something else, such as periodic timer. The result still need to be use by trigger wifi scan result. The faster way to scan is actually using condition wifi available. It actually packs in wifi scan, including providing variables for the next elements. So you can just use periodict timer with condition wifi available, and check the surrounding wifi periodically. I am using wifi disconnect first, because that happen less frequently than using a full dedicated period timer. Thus more battery friendly if you use 2 stage of exiting, need to disconnect first and then scan for wifi.
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.