Issue
How to launch an application with console arguments via adb on Android 10?
Search in docs https://developer.android.com/studio/command-line/adb
Googled for two days, everywhere they write what they need like this:
adb shell am start -S -D -n projectname.app/com.unity3d.player.UnityPlayerActivity --es args '"-runTests"'
Tried some more options but nothing worked
The application is a game on Unity, there I display System.Environment.GetCommandLineArgs() directly
Solution
I think this is a misunderstanding because Android apps do not have command-line arguments as all app processes are forked from the dalvik virtual machine process.
The options you set on am start
are intent options, so you have to get those options e.g. in onCreate
of the UnityPlayerActivity
class:
String arg = intent.getStringExtra("args");
Log.d("", arg); // would in your example output "-runTests"
Answered By - Robert
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.