Mobile/Fennec/Android/AdvancedTopics: Difference between revisions

Updated the commands to launch Fennec via adb
(Updated the commands to launch Fennec via adb)
Line 233: Line 233:
If you need to set an environment variable at run time, append '''--es env# VAR=VAL''' to your activity manager command where # is the ordered number of variables for example:  
If you need to set an environment variable at run time, append '''--es env# VAR=VAL''' to your activity manager command where # is the ordered number of variables for example:  


   adb shell am start -a android.activity.MAIN -n org.mozilla.fennec_$USER/.App --es env0 VAR=val --es env1 FOO=bar
   adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.mozilla.fennec_$USER/org.mozilla.gecko.App --es env0 VAR=val --es env1 FOO=bar


If you need to pass arguments at run time, append '''--es args "<your-args>"''' to your activity manager command. For example, to launch with a specific profile:  
If you need to pass arguments at run time, append '''--es args "<your-args>"''' to your activity manager command. For example, to launch with a specific profile:  


   adb shell am start -a android.activity.MAIN -n org.mozilla.fennec_$USER/.App --es args "--profile /mnt/sdcard/myprofile"
   adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.mozilla.fennec_$USER/org.mozilla.gecko.App --es args "--profile /mnt/sdcard/myprofile"


To launch with a specific URL, use the am -d option to set the intent's data URI:
To launch with a specific URL, use the am -d option to set the intent's data URI:


   adb shell am start -a android.activity.MAIN -n org.mozilla.fennec_$USER/.App -d 'http://www.mozilla.org'
   adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.mozilla.fennec_$USER/org.mozilla.gecko.App -d 'http://www.mozilla.org'


=== C++ Logging ===
=== C++ Logging ===
Line 247: Line 247:
You can use the env vars as described above to enable MOZ_LOG logging from C++ code:
You can use the env vars as described above to enable MOZ_LOG logging from C++ code:


   adb shell am start -a android.activity.MAIN -n org.mozilla.fennec_$USER/.App --es env0 MOZ_LOG=all:5 --es env1 MOZ_LOG_FILE=/mnt/sdcard/log.txt
   adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.mozilla.fennec_$USER/org.mozilla.gecko.App --es env0 MOZ_LOG=all:5 --es env1 MOZ_LOG_FILE=/mnt/sdcard/log.txt


If no file is specified, logging is directed to the android logs:  
If no file is specified, logging is directed to the android logs:  


   adb shell am start -a android.activity.MAIN -n org.mozilla.fennec_$USER/.App --es env0 MOZ_LOG=all:5
   adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.mozilla.fennec_$USER/org.mozilla.gecko.App --es env0 MOZ_LOG=all:5


Look for lines marked "Gecko" with one of the requested log keys in the adb logcat output.
Look for lines marked "Gecko" with one of the requested log keys in the adb logcat output.
Confirmed users
407

edits