如何启动我通过意向直接安装第三方Android应用程序? [英] How to launch the third-party android applications I installed through Intent directly?
问题描述
我们可以推出Android市场的应用从:
we can launch android market application from:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData("market://details?id=packgename");
startActivity(intent);
我的问题是如何启动我通过意向直接安装第三方Android应用程序?难道你们有什么想法?
My question is how to launch the third-party android applications I installed through Intent directly? Do you guys have any ideas?
推荐答案
为了做到这一点,你需要找到应用程序要启动以下信息:
In order to do that, you need to find the following info for the application you want to start:
- 包
- 启动类
如果您经常启动第三方应用程序,你可以获取此信息,并在LogCat中检查跟踪。
You can obtain this info if you start third-party app regularly, and in the LogCat inspect the trace.
然后,您只需填写你所获得的信息如下意向:
Then, you just fill in following intent with the info you obtained:
Intent startupIntent = new Intent();
ComponentName distantActivity = new ComponentName("com.third.exampleapp", "com.third.exampleapp.StartupClass");
startupIntent.setComponent(distantActivity);
startupIntent.setAction(Intent.ACTION_MAIN);
startActivity(startupIntent);
请注意,这是非常不好的做法,开始标准的Android系统,意图通过这种方式。
Please note that it is very bad practice to start standard Android system Intents this way.
这篇关于如何启动我通过意向直接安装第三方Android应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!