I created a Tasker plug-in action in Automate to sync the media library from kodi at regular intervals. This works fine, but only if yatse is, or was until recently, in the foreground. If yatse hasn’t been used in a while and this action triggers, I get the following log message:
02-03 12:09:53.403 F 48@2: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.twofortyfouram.locale.intent.action.FIRE_SETTING pkg=org.leetzone.android.yatsewidgetfree cmp=org.leetzone.android.yatsewidgetfree/com.joaomgcd.taskerpluginlibrary.action.IntentServiceAction (has extras) }: app is in background uid UidRecord{8f76d11 u0a351 CAC bg:+2d2h54m43s855ms idle change:cached procs:1 seq(49,49,49)}
Is it expected that the tasker plug-in only works when the app is in foreground? Could you otherwise verify that it works in Tasker (maybe Automate does something iffy)? Any other Idea?
I’m running Android version 11 on a Samsung S21, any other information that may be useful?
For now I’ve made a workaround so that automate only triggers media sync if the app is in the foreground, but it would be nice if that wasn’t needed…
OK, thanks, than it’s probably just me not grasping the android app terminology. I’ll take this over to the Automate community if I find the workaround too cumbersome. Nevertheless, in case anyone else finds it useful (or can see some obvious flaw) this is what I’ve gathered so far:
The “Plug-in action” block (which executes Tasker/Locale plug-in “setting” actions) works with the following configuration, but only if the app is in foreground:
Plug-in: Command (Yatse)
Type: “Start synchronization”
Media to sync: ALL
The “Service start” block can trigger the Tasker plugin runner, but only if the app is in the foreground. It doesn’t start syncing though, so there is probably something wrong with the parameters or something.
Package: org.leetzone.android.yatsewidgetfree
Service class: com.joaomgcd.taskerpluginlibrary.action.IntentServiceAction
Action: org.leetzone.android.yatsewidget.ACTION_MEDIA_SYNC
Data URI: <empty>
MIME type: <empty>
Category: <empty>
Extras: {“org.leetzone.android.yatsewidet.EXTRA_STRING_PARAMS”: “ALL”}
Flags: <empty>
The “Broadcast send” block is the most promising as it can trigger the Tasker plugin runner even if the app is in the background. But just like with the service block, it doesn’t actually start syncing, so some parameter is probably wrong:
Package: org.leetzone.android.yatsewidgetfree
Service class: com.joaomgcd.taskerpluginlibrary.action.BroadcastReceiverAction
Action: org.leetzone.android.yatsewidget.ACTION_MEDIA_SYNC
Data URI: <empty>
MIME type: <empty>
Category: <empty>
Extras: {“org.leetzone.android.yatsewidet.EXTRA_STRING_PARAMS”: “ALL”}
Flags: <empty>
yes, I thought so too, but it’s a drop down list and there is no option about foreground. There is an “Start App” block but I can only get it to bring up the ui (it also lists other activity classes than the service block). I think it is the “Broadcast send” block I want to use, at least I can trigger the tasker plugin from it regardless of foreground/background app state (it also has a foreground flag, but it doesn’t seem to be needed). EDIT: by “trigger the tasker plugin” I mean that I get the notification about the plugin starts, but it doesn’t actually seem to do anything and disappears after a short while.
On the wiki there is no mention about sending broadcast to yatse, only that yatse can send broadcast messages. Is this because it’s not supported or because the usage is the same as “basic intent usage”?
Automate lists lots of service classes for both service, app and broadcast block, but there is no mention of such classes on the wiki. Is this because they’re not expected to be needed or because a normal android developer would figure it out anyway?
Sorry for the basic questions, but I’m really grateful for your replies, you’ve already earned an extra donation from me today, but feel free to abandon the thread if you think it gets too much out of scope
P.S. I edited the previous post as I had copy pasted a bit wrong for the service class in the broadcast send block.