How to start an application using android ADB tools?

后端 未结 11 1077
醉酒成梦
醉酒成梦 2020-11-22 07:23

How do I send an intent using Android\'s ADB tools?

相关标签:
11条回答
  • 2020-11-22 07:45

    We can as well start an application by knowing application type and feeding it with data:

    adb shell am start -d "file:///sdcard/sample.3gp" -t "video/3gp" -a android.intent.action.VIEW
    

    This command displays available Video Players to play sample.3gp file

    0 讨论(0)
  • 2020-11-22 07:52
    adb shell
    am start -n com.package.name/com.package.name.ActivityName
    

    Or you can use this directly:

    adb shell am start -n com.package.name/com.package.name.ActivityName
    

    You can also specify actions to be filter by your intent-filters:

    am start -a com.example.ACTION_NAME -n com.package.name/com.package.name.ActivityName 
    
    0 讨论(0)
  • 2020-11-22 07:52

    monkey --pct-syskeys 0 for development boards

    Without this argument, the app won't open on a development board without keys / display:

    adb shell monkey --pct-syskeys 0 -p com.cirosantilli.android_cheat.textviewbold 1
    

    and fails with error:

    SYS_KEYS has no physical keys but with factor 2.0%
    

    Tested on HiKey960, Android O AOSP.

    Learned from: https://github.com/ARM-software/lisa/pull/408

    Also asked at: monkey test : If the Android system doesnt has physical keys ,what are the parameters need to be includeded in the command

    0 讨论(0)
  • 2020-11-22 07:54

    It's possible to run application specifying package name only using monkey tool by follow this pattern:

    adb shell monkey -p your.app.package.name -c android.intent.category.LAUNCHER 1
    

    Command is used to run app using monkey tool which generates random input for application. The last part of command is integer which specify the number of generated random input for app. In this case the number is 1, which in fact is used to launch the app (icon click).

    0 讨论(0)
  • 2020-11-22 07:55

    Step 1: First get all the package name of the apps installed in your Device, by using:

    adb shell pm list packages

    Step 2: You will get all the package names, copy the one you want to start using adb.

    Step 3: Add your desired package name in the below command.

    adb shell monkey -p 'your package name' -v 500

    For Example:
    adb shell monkey -p com.estrongs.android.pop -v 500 to start the Es explorer.

    0 讨论(0)
  • 2020-11-22 07:55

    open ~/.bash_profile and add these bash functions to the end of the file

    function androidinstall(){
       adb install -r ./bin/$1.apk
    }
    function androidrun(){
       ant clean debug
       adb shell am start -n $1/$1.$2
    }
    

    then open the Android project folder

    androidinstall app-debug && androidrun com.example.app MainActivity
    
    0 讨论(0)
提交回复
热议问题