This is an example of Automate flow. To learn more about Automate for Android phones, click here.
It is always a good idea to disable the Bluetooth function of your Android phone until you want to pair it with another Bluetooth device, such as hands-free system, GPS, audio speaker, input device (keyboard, mouse, gamepad, ...), etc. This will help to conserve some battery usage of your phone.
However, if you are always wearing a Bluetooth smartwatch that paired with your smartphone, you will need to let the Bluetooth function of your phone to always stay on. In that case, this Automate flow might not be so relevant for your need.
Nowadays, driving laws in many places in the world prohibit holding your phone in your hand while driving. If you are caught with that, you could be imposed with penalty and fine. Therefore, you need a hands-free system to answer to phone calls while driving. Many modern cars already have built-in hands-free function in their audio system. Certain automotive GPS device such as Garmin DriveAssist, Garmin DriveSmart, etc. is also able to link with your smartphone through Bluetooth to provide hands-free and some other additional functions.
Well, if you always disable Bluetooth of your Android phone and manually enable it whenever you want to pair it with a Bluetooth device, it would be very tedious if you are a frequent driver. You will need to enable Bluetooth whenever you sit in your vehicle and started its engine, and disable Blueooth whenever you parked your vehicle and stopped its engine, otherwise you will not be able to use the hands-free function. This Automate flow will help you to automatically perform those action.
In addition, normally when we are in a vehicle on the road, there is no WiFi available. This flow will also help you to disable WiFi when it detected you are travelling in a vehicle. You can edit the flow and remove the "Disable WiFi" block in it if your vehicle does provide WiFi connection that you want to use.
The flow begins with a block to stay and wait until it detected your Android phone carried along with you is travelling in a vehicle. This is a very interesting Automate block. Beside "in vehicle", it can also detect whether you or your phone is:
- On bicycle
- On foot
- Running
- Still
- Tilting
- Walking
- Unknown
The flow will continue its further actions when it is at least 85% sure that you are in a vehicle. The detection interval is set at 2 minutes. If you want the flow to react faster, you can shorten this detection interval, but it might drain more battery at the same time.
Once it detected you are in a vehicle, it will disable WiFi function of your phone (Block 3).
It will then detect whether the battery level of your phone is above 30%. If it is below, whether your phone is plugged to a power source for charging. If both conditions are negative, it will disable Bluetooth and do nothing. I put 30% battery level as this should be sufficient to keep your phone on with Bluetooth paired for quite a long journey. You can adjust this minimum battery level requirement in Block 14 according to your situation. If your driving distance is most of the time pretty short, probably 15% minimum is good enough for you.
If battery level is OK, it will proceed to enable Bluetooth, wait for 10 seconds for your phone to pair with the Bluetooth device in the vehicle (which as a prerequisite, they must be successfully paired before), such as your car audio system hands-free, or your GPS. If the pairing is successful, it will keep the Bluetooth connection until it is disconnected. Disconnection will happen when your car audio system is switched off (when car engine turned off), or when you manually disable your phone Bluetooth function (in case you do not intend to use hands-free during that journey. For example, you are a passenger in your own car which one of your family member is driving for that trip).
It will wait for 3 minutes before going back to detect whether you are in a vehicle again. 3 minutes is a reasonable minimum time interval for you to leave your car and then to drive it again. That will be the estimated time to stop the car engine, pump the petrol, and resume driving. For other occasions, probably the interval is much longer. You can edit Block 13 to change this interval shorter or longer to suit your need too.
In the event Bluetooth pairing failed after the Bluetooth is enabled, you are very likely to be not in your own car, but in another vehicle either as passenger or driver. Since the hands-free function is not available to you in that vehicle, the flow will proceed to disable Bluetooth and wait for a longer 30 minutes (which you can edit Block 20 to change it to be shorter or longer). 30 minutes is an estimation that you will probably won't drive in your own car, since you are travelling in another vehicle at that moment.
In fact, you can remove both Block 13 and Block 20 and immediately go back to activity checking if you want. The 2 delay blocks are merely for the flow to take a break (and save some battery).
http://voyager8.blogspot.my/2017/12/automate-flow-auto-enable-bluetooth-to.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+blogspot/nzRYh+%28The+8th+Voyager%29