I have copied and pasted together some code to test if MicroDroid can send Intents to "turn on/off" an app.
Using 'android.intent.action.SENDTO' with extra string data, the test worked well on an android 10 phone.
If the app was already running then sending an intent would "turn it off".
If the app was not running then sending an intent would "turn it on".
When I tried the setup on a phone running android 13, things didn't go so well.
I could get the turn on function but not the off function.
I assumed finishAndRemoveTask is ok for android 13. It was discussed in an Android developers article, last updated 2023-03-21.
I searched for permission changes but had no luck finding any correlation to what I was trying to do.
Could somebody help me with the magic "Why is it so" and/or some topics to read and learn.
Using 'android.intent.action.SENDTO' with extra string data, the test worked well on an android 10 phone.
If the app was already running then sending an intent would "turn it off".
If the app was not running then sending an intent would "turn it on".
When I tried the setup on a phone running android 13, things didn't go so well.
I could get the turn on function but not the off function.
intent test:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
End Sub
Sub Activity_Resume
Dim i As Intent
i = Activity.GetStartingIntent
If i <> Null Then
If i.HasExtra("Settings") Then
If i.GetExtra("Settings") = "stuff" Then
Sleep(1000)
CloseActivity
End If
End If
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub CloseActivity
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("finishAndRemoveTask", Null)
End Sub
intent filter:
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
I assumed finishAndRemoveTask is ok for android 13. It was discussed in an Android developers article, last updated 2023-03-21.
I searched for permission changes but had no luck finding any correlation to what I was trying to do.
Could somebody help me with the magic "Why is it so" and/or some topics to read and learn.