Bug 411018

Summary: Running a command from the Android app using a URL, does not work anymore on the background from Android 10 (Q) and up.
Product: [Applications] kdeconnect Reporter: Jolan <jolanrensen>
Component: android-applicationAssignee: Albert Vaca Cintora <albertvaka>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Android   
OS: Other   
Latest Commit: Version Fixed In:

Description Jolan 2019-08-17 18:11:45 UTC
SUMMARY
Running a command from the Android app using a URL, does not work anymore on the background from Android 10 (Q) and up.

STEPS TO REPRODUCE
1. Have an Android device running Android Q beta 6 (or higher when available)
2. Connect to a pc, add a command, long press the command to copy the URL
3. Have an automation app like "Tasker" open the copied URL in automated manner

OBSERVED RESULT
When Tasker is opened, the URL works, KDE Connect opens and the command is executed.
When Tasker is not opened in the direct foreground, the URL can not be opened as Android Q now prohibits apps from opening activities from the background.

EXPECTED RESULT
On older Android versions, opening an activity from the background (as is the case here) worked fine, but on Q nothing happens when the URL should open.

SOFTWARE/OS VERSIONS
Android: 10.0 (Q)

ADDITIONAL INFORMATION
A good and working solution would be to implement the Takser (Locale) API which allows a couple of automation apps (where Tasker is simply the most popular one) to send commands in automated manner to KDE Connect.
Information can be found here: https://tasker.joaoapps.com/developers.html

What is required, is an "action plugin", which broadly requires an activity where the user can choose which command to execute and a broadcast receiver, to execute a set-up command when Tasker sends the signal.
https://tasker.joaoapps.com/plugins.html

What works even faster (but is Tasker specific) is using an IntentService in addition to a broadcast receiver.
This is explained here: https://tasker.joaoapps.com/pluginsservicesmigration.html
Comment 1 Jolan 2019-09-12 11:11:59 UTC
I just found out a temporary workaround. Background activity launches are not prohibited for apps running an accessibility service (as described here https://developer.android.com/guide/components/activities/background-starts). This means that granting for instance Tasker accessibility access, will allow the app to launch a url from the background and thus execute the remote KDE Connect command.