jecelyin / 920-Text-Editor-old

new project
https://github.com/jecelyin/920-text-editor-v2/
Other
200 stars 87 forks source link

from terminal, how to launch to edit file? #25

Closed bdantas closed 9 years ago

bdantas commented 9 years ago

This may not be the right place to ask this, but I've been stumped for days and am in desperate need of help with this issue.

I would like to know how to launch the editor from terminal emulator (I need this for a script that I'm working on).

As an example, how would I open /storage/emulated/0/Download/test.txt for editing?

When I try this: am start -a android.intent.action.EDIT -n com.jecelyin.editor/.JecEditor -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 try to work around it with this: am start --user 0 -a android.intent.action.EDIT -n com.jecelyin.editor/.JecEditor -d /storage/emulated/0/Download/test.txt

Now the editor starts, but it opens a new file and not the specified file. I've also tried different test files to exclude the possibility that test.txt is corrupt.

I'm stuck. Please help!


OS: CM11 Device: Moto G Relevant apps: Terminal Emulator (jackpal.androidterm 1.0.65), 920 Text Editor (com.jecelyin.editor 12.11.23)

bdantas commented 9 years ago

After countless hours of trial and error, I figured it out. Here it is:

su -c "am start -a android.intent.action.EDIT -n com.jecelyin.editor/.JecEditor -d file:/storage/emulated/0/Download/test.txt"

alanthehat commented 8 years ago

Thank you :+1: :-)