is Install APK On SD Card - Android android.content.pm

Android examples for android.content.pm:Apk Install

Description

is Install APK On SD Card

Demo Code

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

public class Main {

  public static boolean isInstallOnSDCard(Context context, String packageName) {
    try {//from ww w  .jav  a2s  .c  om
      PackageManager pm = context.getPackageManager();
      ApplicationInfo appInfo = pm.getApplicationInfo(packageName, 0);
      if ((appInfo.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) {
        return true;
      }
    } catch (NameNotFoundException e) {
      e.printStackTrace();
    }
    return false;
  }

  public static ApplicationInfo getApplicationInfo(Context context) {
    return context.getApplicationInfo();
  }

}

Related Tutorials