Register Locus Add-on handler during runtime.

Falco shared this question 13 days ago
Answered

Locus Tasker Add-On Users are able to create custom Tasks for Locus. Some Tasks need to be executed manually.

I did register "Run Task" in Manifest to get an generic "Run Task" Button in Locus for all manually executed Tasks.


Would it be possible to create task specific Buttons during Runtime? Well, I could create a Button for each known usecase in Manifest but I don't want to register 5 buttons because users may only need 1 of 5 and don't want to have 5 Buttons in there point detail share menu.


For that reason I would like to register new Buttons based on User decision during runtime. I guess I can't alter my manifest file during App runtime to achieve the goal, isn't it?


Do you have any suggestions?


Kind Regards

Falco

Comments (7)

photo
1

It is maybe possible to tell the user to export there Tasks as an "App". But I have to test the limitations of Tasker Task Apps.

https://tasker.joaoapps.com/userguide/en/appcreation.html

At least I know that the App export solution is only useable as Locus panel buttons. I can't place this custom app to point detail share menu.

photo
1

Good day Falco,

no sure, I've never tried register intent-filter dynamically. But after quick search, this seems not to be possible.


Anyway it looks that this may work: https://developer.android.com/guide/topics/manifest/activity-alias-element

Maybe define 5 "activity-aliases" in your manifest and then enable/disable them . Inspiration: https://stackoverflow.com/a/10403074/836138 ?

photo
1

Thank you, this is a great idea to handle special places like point share menu.

And even better, the tasker solution for generating apps works great, too. I do currently work on the documantation.

photo
photo
1

You are a magician :)

photo
1

... said the tech lead of the most versatile outdoor navigation app to the non android developer.

:D

photo
photo
1

Locus does respond very well to the dynamic enabling and disabling of activity-alias components.


But you have to be careful with disabling because this will destroy parts of the application context or even all of it? https://github.com/Falcosc/locus-addon-tasker/commit/adf60cc6823455eeaf6ddc3ae68ee7912d7e567f#diff-70a6f463cf912ede410f55da5862370aR38


Each click on the track share button does refresh the list of enabled activities without any delay. Well done.