owntracks / android

OwnTracks Android App
http://owntracks.org
Eclipse Public License 1.0
1.34k stars 475 forks source link

Owntracks mode automation using LlamaLab's Automate #900

Closed falconapps closed 3 years ago

falconapps commented 3 years ago

I've been using Owntracks 2.2.1 on my Pixel 5 (Android 11) for some time, all good. Now I want to automate changing monitoring mode using LlamaLab's automate, presumably using the Broadcast Send block. It seems like it should work but I'm missing something. My block currently includes only the following:

Action: org.owntracks.android.CHANGE_MONITORING Extras: { "monitoring" as Int: 2 }

I've tried many other combinations without success. Has anyone experience with this?

growse commented 3 years ago

I wonder if it's because you're sending the intent as a broadcast, rather than targetting the service. I know that Tasker has the option of targetting either an activity, service or broadcast for its "Send Intent" task (https://tasker.joaoapps.com/userguide/en/intents.html) and that this functionality works with OT when the "Service" is the target.

Can you try using the "service start" block to see if that works? https://llamalab.com/automate/doc/block/service_start.html

falconapps commented 3 years ago

That's done the trick - thanks very much!

"Service Start" Package: org.owntracks.android Service Class: org.owntracks.android.services.BackgroundService Action: org.owntracks.android.CHANGE_MONITORING Extras: { "monitoring" as Int: 2 }