简体   繁体   English

找出apk的类名

[英]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. 目前,我已成功启动Facebook,因为ActivityPackage和ActivityClass已知。 I want to launch other apps such as twitter, gplus, gtalk, gmail etc. How do I find out the corresponding Class Names? 我想推出其他应用程序,如twitter,gplus,gtalk,gmail等。如何查找相应的类名? Finding out the package name is easy with packagemanager, but I dont find the class name with the same method. 使用packagemanager可以很容易地找到包名,但是我没有找到具有相同方法的类名。

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. android-apktool可以扩展您感兴趣的软件包的清单。这将告诉您哪些活动可用以及应用了哪些intent过滤器。

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. 您可以在PackageManager中查询旨在启动的活动。 Here is a sample project demonstrating this. 这是一个示例项目

Currently, I am successful with launching facebook as the ActivityPackage and ActivityClass is known. 目前,我已成功启动Facebook,因为ActivityPackage和ActivityClass已知。

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. 你知道,你应该意识到Facebook可以随时更新他们的应用程序,改变Facebook选择的活动。 You should realize that, when Facebook does this, any code that depended on the original undocumented, unsupported Intent structure (eg, classes) will break. 您应该意识到,当Facebook执行此操作时,任何依赖于原始未记录的,不受支持的Intent结构(例如,类)的代码都将中断。 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? 我想推出其他应用程序,如twitter,gplus,gtalk,gmail等。如何查找相应的类名?

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: 看看这个python代码,了解如何获取包/活动名称:

http://voyager.wordpress.com/ http://voyager.wordpress.com/

This website provide a python script to analyze the output of " aapt ". 这个网站提供了一个python脚本来分析“ aapt ”的输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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