mercredi 18 mars 2015

[Q] how to launch an app from the terminal, opening specified file?

From the terminal, I would like to learn how to open a file in an android app.



As an example, how would I open /storage/emulated/0/Download/test.txt in Ted lightweight text editor?



When I try this:

Code:



am start -a android.intent.action.EDIT -n fr.xgouchet.texteditor/.TedActivity -d /storage/emulated/0/Download/test.txt


I get an error that includes "Permission Denial: startActivity asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL"



I'm not sure exactly what that's about, so I tried to work around it with this:

Code:



am start --user 0 -a android.intent.action.EDIT -n fr.xgouchet.texteditor/.TedActivity -d /storage/emulated/0/Download/test.txt


Now Ted editor starts, but it opens a new file and not the specified file (one time there was a message at the top saying something to the effect that the specified file could not be opened). I've tried multiple test files to exclude the possibility that test.txt is corrupt, with identical results.



I'm stuck. Please help!



------------------

OS: CM11

Device: Moto G

Relevant apps: Terminal Emulator (jackpal.androidterm 1.0.65), Ted (fr.xgouchet.texteditor 1.8.1)





from xda-developers http://ift.tt/1B0mGza

via IFTTT

Aucun commentaire:

Enregistrer un commentaire

LightBlog