找出apk的类名
我正在开发一个应用程序,应该能够启动手机上安装的另一个应用程序。目前,我成功启动了 facebook,因为 ActivityPackage 和 ActivityClass 是已知的。我想启动其他应用程序,例如twitter、gplus、gtalk、gmail等。如何找到相应的类名?使用packagemanager查找包名很容易,但我没有用相同的方法找到类名。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设您没有尝试在运行时执行此操作...
android-apktool 可以展开您感兴趣的包的清单。这将告诉您哪些活动可用以及应用了哪些意图过滤器。
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.
您可以查询
PackageManager
来查找旨在启动的活动。 这是一个示例项目演示了这一点。不要这样做。
你看,你应该意识到 Facebook 可以随时更新他们的应用程序,根据 Facebook 选择改变活动。您应该意识到,当 Facebook 这样做时,任何依赖于原始未记录的、不受支持的
Intent
结构(例如类)的代码都将被破坏。您应该意识到,损坏的应用程序会导致用户在市场上给该应用程序评分和评论较差等。不要这样做。请根据上述示例项目使用声明为属于启动器的活动。
You can query
PackageManager
for activities that are designed to be launched. Here is a sample project demonstrating this.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 (e.g., 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.Don't do this. Please use the activities declared as belonging in the launcher, per the aforementioned sample project.