Starting One Android App from Another App

后端 未结 3 1607
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 04:19

What is the best way to start one android app from another app? Is it to send custom broadcast event and have broadcast receiver of other app catch this event and do a star

相关标签:
3条回答
  • 2020-12-20 04:32

    Use an Intent: http://developer.android.com/guide/topics/intents/intents-filters.html

    Use Context.startActivity() to just launch, or Activity.startActivityForResult() if you want to get a result when it's done.

    If you are tightly coupled with the other application, you can use an explicit Intent. Otherwise, send an implicit Intent.

    0 讨论(0)
  • 2020-12-20 04:39

    Use this:

    PackageManager pm = getPackageManager();
    try
    {
        String packageName = "com.example.package";
        Intent launchIntent = pm.getLaunchIntentForPackage(packageName);
        startActivity(launchIntent);
    }
    catch (Exception e1)
    {
    }
    
    0 讨论(0)
  • 2020-12-20 04:46

    best way is call by intent like this

    http://www.lacherstorfer.at/haris_blog/2008/03/android-howto-invoke-a-phone-c.html

    0 讨论(0)
提交回复
热议问题