(2023-03-31, 23:21)Paco8 Wrote: I tried StartAndroidActivity, it works. The problem is that this command doesn't wait until the android app has finished.
I also tried to call the app with am start from the addon but for some reason it didn't work (call returns an error).
ah yes i could not find a wait function either, am has a -W which wait for it to start but doesnt actually wait until the app has ended
i think a workaround would be needed, something with a cancellable wait window
something like removing the keyfile (or otherwise making sure it doesnt exist) then start the app and do a wait in the script until its cancelled or exists
python:
import os.path
import time
while not os.path.exists(key_file):
time.sleep(1)
as far as starting from am, it doesnt provide anything extra (and perhaps worse?) but here's the command that works for that
Code:
am start -n paco8.skyextractcookie/.MainActivity -e platform PeacockTV
-----
i also thought it would be useful to find a way to install the app from kodi but i came up with no good solutions, the android updater app does work well so maybe something can be used from it
i did put together a quick downloader however, but cant find a way to invoke installation
python:
import requests
url = 'https://github.com/Paco8/SkyExtractCookieAndroid/releases/download/v1.0.0/SkyExtractCookie-1.0.0.apk'
req = requests.get(url)
with open('/sdcard/Download/skyextractcookie.apk','wb') as output_file:
output_file.write(req.content)
(im absolutely positive you can do better than that 5m script but its what i was using)
-----
EDIT:
with no viable options to initiate the installation you can use one of these to start the file manager to show the downloads, should exist on most if not all android boxes
(this is how the android updater does it)
am start --user 0 -n com.android.documentsui/com.android.documentsui.files.FilesActivity
am start --user 0 -n com.android.documentsui/com.android.documentsui.ViewDownloadsActivity
recommend using a toast message in the app upon completion when it's been called with extras so it may close without further interaction