androidyahoo

Launch Yahoo Mail from another app


The code below is used to launch Facebook:

Intent intent = new Intent("android.intent.category.LAUNCHER");
intent.setClassName("com.facebook.katana", "com.facebook.katana.LoginActivity");
startActivity(intent);

I trying to accomplish the same for Yahoo Mail App.

Any idea what names need to be used in the Intent and setClassName statement?

Thanks


Solution

  • You can use PackageManager.getLaunchIntentForPackage(packageName) to retrieve the Intent associated with launching an app:

    PackageManager packageManager = getPackageManager(); // from any Context
    Intent intent = packageManager.getLaunchIntentForPackage(
        "com.yahoo.mobile.client.android.mail");
    

    This has the benefit of continuing to work even if they update the application to use a different main activity.