Reputation: 18482
I am trying to write an Android application, which is launched by a system script. Application is supposed to prompt for a text and output it to stdout, so that script could consume it. EDIT: To clarify something here: Script is launched by encfs --extpass option.
I know how android application can write to a console: System.console().printf("text");
I know how to launch activity from the script: am start -n com.pkg.App/.MyActivity
I have no idea how to actually make an application launched that way to actually output anything to the console that launched it. Application seems to go do its stuff, and nothing gets returned to console.
Maybe I am approaching the whole issue wrong and there is an easier way to prompt for a text from script?
Upvotes: 0
Views: 523
Reputation: 22637
why not write an android app that hosts the entire sequence? android can use Runtime class to launch scripts or native command line applications. it can pass them arguments and capture the output and pass it on to other scripts, etc.
if that doesn't work, for example, because you don't have control of when encfs needs to be invoked, another idea would be to launch the android app from the system script as you suggested, and have it write the output to a file when it's done. the system script would need to monitor for the existence of the file, because otherwise it would not know when the input is ready. leave System.console()
out of it.
Upvotes: 1