Does locus send any public intents when starting-pausing-stopping track record?

Дмитрий Гордеев shared this question 2 years ago
Answered

There are public intents I can send from other apps, such as Tasker, to make Locus do something. But does it work the other way as well? Can I listen in Tasker when Locus starts/stops track recording? I need it to automatically turn GPS off and on.

Comments (11)

photo
1

Good day,


exactly this is currently not possible. Locus broadcast "Periodic updates", this means pack of information that may be received by 3rd party application and handled. In this pack are information like if track record is running, it's values, location of GPS, location of map center etc.


Anyway it's made mainly for app developers and make it work in tasker should be quite complicated (not sure if possible at all). Unfortunately as I see, there is still missing documentation on our docs.locusmap.eu for this feature.


So if you are skilled with Android developing, you may check Locus API - sample application from where should be clear how it works. Otherwise I'm sorry, I do not have simple solution on this task for now.

photo
1

And what is the period of these updates? I mean if this period is for instance 1 sec, is it safe to assume that if I don't receive this intent for 2 seconds that means that there is no recording?

photo
1

You receive intent even if there is no recording. Just in intent contains this information. Period is once per second.

photo
1

I created a profile in Tasker for receiving intent locus.api.android.ACTION_PERIODIC_UPDATE but it was never triggered, though Locus Pro is running and recording a track. Why can this happen? I reloaded Tasker several times, so I'm sure the profile is active

photo
1

Do you have enabled "Enable periodic updates for Add-ons" in settings : http://docs.locusmap.eu/doku.php?id=manual:user_guide:settings:misc ?


If it won't work at first attempt, suggest to restart Locus first.

photo
1

Yes, it was already enabled. I tried to disable it and enable back again, but still no luck

photo
1

Don't know what Tasker do and how it do.


You may also try one more thing if you wants. Right after you enable Broadcast receiver in Tasker, you may try to send simple Broadcast intent to Locus with action "com.asamm.locus.ACTION_REFRESH_PERIODIC_UPDATE_LISTENERS"


This cause, that locus reloads all available broadcast listeners to which send updates.

photo
1

I don't have any add-ons installed. Can this cause ACTION_PERIODIC_UPDATE not being sent?

photo
1

For cases, broadcast listener is not registered in manifest of application, exists mentioned "refresh" intent I wrote before. This cause, that Locus scan installed active listeners and create internal list. If at least one active listener is found, Locus starts broadcasting.

photo
1

I tried ACTION_REFRESH_PERIODIC_UPDATE_LISTENERS but it didn't help.

Tasker docs say that:

some intent senders require that a corresponding intent filter is specified statically (i.e. in an Android Manifest). Those intents cannot be received.


May be this is the case with locus.api.android.ACTION_PERIODIC_UPDATE?

photo
1

Hmm, shortly: many add-ons use this technique and it works. I also use in around five add-ons I made for Locus and it works as well. Sorry, but I cannot help here, as it will needs to install tasker and try it on my own (because tasker maybe do something little bit differently), and I do not want to spend time on it. Thanks for understanding.