2

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 start activity on something? Thanks

ASP
  • 3,645
  • 1
  • 31
  • 45
Androider
  • 21,125
  • 36
  • 99
  • 158
  • This one http://stackoverflow.com/questions/2728465/how-to-call-one-android-application-from-another-android-application is the oldest and the best QA on the theme – Gangnus Jan 30 '14 at 11:02
  • Possible duplicate of [Launch an application from another application on Android](http://stackoverflow.com/questions/3872063/launch-an-application-from-another-application-on-android) – Yksh Nov 17 '15 at 10:17

3 Answers3

4

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.

Sparky
  • 8,437
  • 1
  • 29
  • 41
  • Hey sparky are you in Munich. I used to do work for one of automotives there. Do you have URL on profile? – Androider Apr 13 '11 at 22:32
3

best way is call by intent like this

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

Rohit Mandiwal
  • 10,258
  • 5
  • 70
  • 83
3

Use this:

PackageManager pm = getPackageManager();
try
{
    String packageName = "com.example.package";
    Intent launchIntent = pm.getLaunchIntentForPackage(packageName);
    startActivity(launchIntent);
}
catch (Exception e1)
{
}
A. Abiri
  • 10,750
  • 4
  • 30
  • 31