开发者

How to launch the third-party android applications I installed through Intent directly?

we can launch android market application from:

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.setData("market://detai开发者_开发知识库ls?id=packgename");

startActivity(intent);

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:

  • Package
  • Startup Class

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);    

Please note that it is very bad practice to start standard Android system Intents this way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜