List of usage examples for android.content Context getPackageName
public abstract String getPackageName();
From source file:Main.java
public static Class<?> getR_ID_Class(Context context) { try {//from w ww. ja v a 2s . com return Class.forName(context.getPackageName() + ".R$id"); } catch (ClassNotFoundException e) { Log.e("TAG", e.getMessage()); } return null; }
From source file:Main.java
/** get link path of device*/ public static String getUserPath(Context context) { String path = context.getPackageName(); String userPath = "/data/data/" + path; try {/* w w w. j av a 2 s . c o m*/ PackageInfo p = context.getPackageManager().getPackageInfo(path, 0); userPath = p.applicationInfo.dataDir; } catch (NameNotFoundException e) { } return userPath; }
From source file:Main.java
public static boolean isFreeVersionInstalled(Context context) { return context.getPackageManager().checkSignatures(context.getPackageName(), "com.nolanlawson.keepscore") >= 0; }
From source file:Main.java
public static void openMark(Context context) { Uri uri = Uri.parse("market://details?id=" + context.getPackageName()); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);/* w w w . ja va 2 s. c om*/ }
From source file:Main.java
public static void GetPackage(Context context) { if (context != null) VideoFileDir = context.getPackageName() + "/" + PublisherId + "/"; }
From source file:Main.java
public static String getVersionName(Context context) { return getVersionName(context, context.getPackageName()); }
From source file:Main.java
public static Uri resourceIdToUri(Context context, int resourceId) { return Uri.parse(ANDROID_RESOURCE + context.getPackageName() + FOREWARD_SLASH + resourceId); }
From source file:Main.java
public static String extStorageDir(Context context) { return extStorageDir(context.getPackageName()); }
From source file:Main.java
public static Class getRClass(Context context) throws ClassNotFoundException { String packageName = context.getPackageName(); String rPackageName = packageName + ".R"; Class rClass = Class.forName(rPackageName); return rClass; }
From source file:Main.java
public static void checkManifest(Context context) { verifyPermission(context, context.getPackageName() + ".permission.C2D_MESSAGE"); verifyPermission(context, "com.google.android.c2dm.permission.RECEIVE"); }