简体   繁体   中英

Find out the class name of an apk

I am developing an app that should be able to launch another app installed on the phone. Currently, I am successful with launching facebook as the ActivityPackage and ActivityClass is known. I want to launch other apps such as twitter, gplus, gtalk, gmail etc. How do I find out the corresponding Class Names? Finding out the package name is easy with packagemanager, but I dont find the class name with the same method.

I'm assuming you're not trying to do this at runtime...

android-apktool can expand the manifests of the the packages you're interested in. That will tell you what activities are available and what intent filters are applied.

I am developing an app that should be able to launch another app installed on the phone.

You can query PackageManager for activities that are designed to be launched. Here is a sample project demonstrating this.

Currently, I am successful with launching facebook as the ActivityPackage and ActivityClass is known.

Don't do this.

You see, you should realize that Facebook can update their app at any time, changing around the activities as Facebook chooses. You should realize that, when Facebook does this, any code that depended on the original undocumented, unsupported Intent structure (eg, classes) will break. You should realize that a broken app will cause users to give the app poor ratings and comments on the Market, etc.

I want to launch other apps such as twitter, gplus, gtalk, gmail etc. How do I find out the corresponding Class Names?

Don't do this. Please use the activities declared as belonging in the launcher, per the aforementioned sample project.

Check out this python code to get idea on how to get package/activity name:

http://voyager.wordpress.com/

This website provide a python script to analyze the output of " aapt ".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM