1

I want to start an app with the package name de.avm.android.fritzapp from a shell prompt because it occasionally quits. I have decompiled the .apk and got the AndroidManifest.xml.

I have launched certain screens of app by:
am start -a android.intent.action.MAIN-n de.avm.android.fritzapp/.gui.SettingsTestActivity

But this is not the same as clicking the app icon on from the home screen. Upon normal startup, the app registers with the router for receiving IP-calls, etc.

So how can I simply start the app as if it had been clicked on?

  • 2
    You do the same command, but launch a different activity. Depending on the app, you may have a MainActivity, but this is up to the developer. Without access to the source (you are not allowed to post anywhere), I can't tell you the name of the main activity. – GiantTree Sep 5 '15 at 9:56
1

TL:DR;
adb shell monkey -p de.avm.android.fritzapp 1


Long Answer

How can I simply start the app as if it had been clicked on?

You can start the main activity of the app
am start -n com.package.name/.MainActivityName

Since you have decompiled the App and got the manifest file so you would have the name of the main activity. You can get this information from the App's AndroidManifest.xml by searching for the activity with intent-filterand also contains android.intent.action.MAIN under action

Check the activity element with skeleton as below

<activity android:name="this.is.main.activity.name you.are.looking.for">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>

You can start this particular app by am start -n app de.avm.android.fritzapp/.gui.FRITZApp


Alternatively if you do not have the source code (manifest file), you can try the more general method where knowing the package name is enough with the help of Monkey tool as below:

adb shell monkey -p package.name 1 (Simplified)

The above command works because Monkey takes a constraint -c <main-category> which if not specified will select activities listed with the category Intent.CATEGORY_LAUNCHER which in turn becomes

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.