Detecting Driving

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
User avatar
piz
Posts: 18
Joined: 13 Dec 2017 19:56

Detecting Driving

Post by piz » 23 Oct 2018 16:25

I want to trigger certain flows when I start/stop driving. It's not clear to me how to do that. Can anyone help?

Thanks!

User avatar
digitalstone
Posts: 338
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Detecting Driving

Post by digitalstone » 23 Oct 2018 17:43

The first question you should ask yourself is, what "thing" would let my phone know that i'm going to drive in my car?
Do you hook it up to something like usb?
And would that be at particular times of the day/week?
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

User avatar
Helios
Posts: 15
Joined: 22 Oct 2018 09:41

Re: Detecting Driving

Post by Helios » 24 Oct 2018 11:14

Hi,

maybe your want to have a look into this User Activity Trigger..

If your car has Bluetooth, this is the way to go.

Otherwise, you have to think about your real-life flow. Maybe something like "Wifi Disconnected from Homenetwork" -> "Wait for USB-Car-Charger" -> "We are in the car".

User avatar
piz
Posts: 18
Joined: 13 Dec 2017 19:56

Re: Detecting Driving

Post by piz » 24 Oct 2018 17:19

I'm testing flows that detect when the car's bluetooth connects/disconnects, but they go on & off all the time as if it's constantly connecting, disconnecting, and reconnecting. I could use a global variable that gets set to true on the first connect but I can't know which disconnect trigger will be the last one to then set the var to false.

I previously tried detecting the launch/closing of the Android Auto app but got the same behavior: start/stop over and over again.

I'm stymied.

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

Re: Detecting Driving

Post by Desmanto » 24 Oct 2018 17:46

It shouldn't flapping like that. There can be some app interfering with the event. Can you add variable logger script to it to see what is going on during the flapping connect/disconnect? If you can spot the pattern, probably you can know which app is causing it. Of course it must be something related to bluetooth.

If the flapping is unavoidable, you can add trigger buffer to protect against the false trigger : viewtopic.php?f=5&t=7229
You can't prevent the flapping, but you can protect the main flow.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190512, Pie 9.0, Rooted.

xdauser
Posts: 30
Joined: 05 Aug 2015 17:55

Re: Detecting Driving

Post by xdauser » 27 Oct 2018 10:31

If your smartphone has NFC module, then NFC tag is also an option. You just stick it somewhere in the car on the dashboard and just touch with your smartphone any time you enter your car to execute flow of your idea. Personally, I have one sticked onto smartphone holder which is permanently installed in my car, so everytime I put my smartphone into holder appropriate action fires up like starting google maps, music application etc... This is quite convenient and effective.

Another option as already mentioned is triggering by car bluetooth system found. The only disadvantage of this is whenever you are close to your car and not necessarily want to drive, the flow gets triggered regardless.

akela
Posts: 6
Joined: 30 Oct 2018 18:03

Re: Detecting Driving

Post by akela » 02 Nov 2018 15:44

NFC is a good option. I wish I have NFC on my phone, but I don't.
Another option is to use the "Scan Barcode" action triggered by a shortcut.
I generate my own barcode from online barcode generator websites, then stick the barcode inside my car.
I scan it and it starts all my car specific flows. It's a bit of a manual process, but with habit, it is quite fast and automatic for me.

I also stick another barcode at my office computer. When I come in to work, I scan barcode it, and it starts all my work specific flows.

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

Re: Detecting Driving

Post by Desmanto » 03 Nov 2018 18:35

@akela : I ever thought about the similar concept too, but using QRCode. But cancelled it because why we should open and scan the code again? Just simply use a simple shortcut at home screen to set all the flow state and variables :)
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190512, Pie 9.0, Rooted.

User avatar
piz
Posts: 18
Joined: 13 Dec 2017 19:56

Re: Detecting Driving

Post by piz » 14 Nov 2018 19:54

I've been doing more testing and I've found that I might have been misinterpreting what I saw. I now think the triggering is correct for the Bluetooth connect/disconnect and all should be well going forward.

Thanks for the help!

hanahana
Posts: 1
Joined: 28 Nov 2018 06:22

Re: Detecting Driving

Post by hanahana » 04 Dec 2018 06:30

I agree with the second comment...
Graduated from Soran University with First Class Degree with Honours in Computer Science

Post Reply