Example usage for android.content.pm PackageManager getLaunchIntentForPackage

List of usage examples for android.content.pm PackageManager getLaunchIntentForPackage

Introduction

In this page you can find the example usage for android.content.pm PackageManager getLaunchIntentForPackage.

Prototype

public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName);

Source Link

Document

Returns a "good" intent to launch a front-door activity in a package.

Usage

From source file:Main.java

public static Intent getLauncherIntent(PackageManager pm, String packageName) {
    Intent intent = pm.getLaunchIntentForPackage(packageName);
    return intent;
}

From source file:Main.java

public static void launchApp(Context context, String packageName) {
    PackageManager pm = context.getPackageManager();
    Intent intent = pm.getLaunchIntentForPackage(packageName);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/* w ww.ja v  a 2  s  .  c  om*/
}

From source file:Main.java

public static void startApplication(Context context, String packageName) {

    PackageManager pm = context.getPackageManager();
    Intent intent = pm.getLaunchIntentForPackage(packageName);
    context.startActivity(intent);//from  w  w w .ja  v  a  2 s.c o m

}

From source file:Main.java

@SuppressWarnings("unused")
public static void launchApk(Context context, String launchApkUrl) {

    PackageManager pm = context.getPackageManager();
    Intent intent = pm.getLaunchIntentForPackage(launchApkUrl);
    context.startActivity(intent);/*from  ww  w.  j  ava  2 s . co  m*/

}

From source file:Main.java

public static void startOtherApp(Context context, String packageName) {
    PackageManager pm = context.getPackageManager();
    Intent launcherIntent = pm.getLaunchIntentForPackage(packageName);
    context.startActivity(launcherIntent);
}

From source file:Main.java

public static void launchApp(Context context, String packageName) {
    PackageManager packageManager = context.getPackageManager();
    Intent intent = packageManager.getLaunchIntentForPackage(packageName);
    context.startActivity(intent);/*from   w  ww  . j  a va2 s .  c o m*/
}

From source file:Main.java

public static void startApplication(Context mContext, String packageName) throws Exception {
    PackageManager packageManager = mContext.getPackageManager();
    Intent intent = packageManager.getLaunchIntentForPackage(packageName);
    mContext.startActivity(intent);/*from   w  ww  .  j a  v a2  s .  co m*/
}

From source file:Main.java

public static void launchApp(Context context, String packageName) {
    PackageManager packageManager = context.getPackageManager();
    Intent intent = packageManager.getLaunchIntentForPackage(packageName);
    if (intent != null) {
        context.startActivity(intent);/*  w w w.  j a v  a  2 s .  c  om*/
    }
}

From source file:Main.java

public static void openApplication(final Context context, String packageName) {
    PackageManager packageManager = context.getPackageManager();
    Intent intent = packageManager.getLaunchIntentForPackage(packageName);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
            | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(intent);//from  w ww. j a v  a2  s .  c o  m
}

From source file:Main.java

public static void openApp(Context context) {
    PackageManager packageManager = context.getPackageManager();
    Intent intent = packageManager.getLaunchIntentForPackage("com.hulaoo");
    if (intent == null) {
        System.out.println("APP not found!");
    }/*  w ww  .jav  a 2s . c om*/
    context.startActivity(intent);
}