List of usage examples for android.content Context getPackageName
public abstract String getPackageName();
From source file:Main.java
public static File getPhoneCacheDir(Context context) { final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(context.getCacheDir().getPath() + cacheDir); }
From source file:Main.java
public static final String getPackageName(Context context) { if (context != null) { return context.getPackageName(); }/*from w ww . jav a 2 s .c om*/ return ""; }
From source file:Main.java
public static void uninstall(Context context) { Uri packageURI = Uri.parse("package:" + context.getPackageName()); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); context.startActivity(uninstallIntent); }
From source file:Main.java
/** * Launch the specified application//w w w . j ava2 s . c o m * * @param context * application context * @param packageName * package name of the application to launch */ public static boolean launchApp(Context context, String packageName) { if (!context.getPackageName().equals(packageName)) // Launch if it is // different app { final Intent LaunchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName); context.startActivity(LaunchIntent); return true; } return false; }
From source file:Main.java
public static String getVersionName(Context mContext) { try {//from w w w. j a v a 2s .c o m String pkName = mContext.getPackageName(); String versionName = mContext.getPackageManager().getPackageInfo(pkName, 0).versionName; return versionName; } catch (Exception e) { } return null; }
From source file:Main.java
public static File getExternalCacheDir(Context context) { final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); }
From source file:Main.java
public static String getVideoUrlFromResource(Context paramContext, int paramInt) { return "android.resource://" + paramContext.getPackageName() + "/" + paramInt; }
From source file:Main.java
/** * Get package name//from ww w. j a va 2s . co m * * @param context * @return */ public static String getPackageName(Context context) { return context.getPackageName(); }
From source file:Main.java
public static String a(Context var0) { String var1 = var0.getPackageName(); String var3; try {/*from w w w .j a va 2 s .c om*/ ApplicationInfo var2 = var0.getPackageManager().getApplicationInfo(var1, PackageManager.GET_META_DATA); var3 = var2.metaData.getString("TencentMapSDK"); if (!TextUtils.isEmpty(var3)) { String var4 = "[&=]"; Pattern var5 = Pattern.compile(var4); Matcher var6 = var5.matcher(var3); var3 = var6.replaceAll(""); } } catch (PackageManager.NameNotFoundException var7) { var3 = "GRYBZ-ACPWV-UIGPO-U2SRZ-KRYB6-7VFTU"; } return var3; }
From source file:Main.java
public static boolean isCatlogFreeInstalled(Context context) { return context.getPackageManager().checkSignatures(context.getPackageName(), "com.nolanlawson.logcat") >= 0; }