Example usage for android.content Context getPackageName

List of usage examples for android.content Context getPackageName

Introduction

In this page you can find the example usage for android.content Context getPackageName.

Prototype

public abstract String getPackageName();

Source Link

Document

Return the name of this application's package.

Usage

From source file:Main.java

public static void init(Context ctx) {
    packageName = ctx.getPackageName();
    resources = ctx.getResources();/*from  w ww .ja v a  2  s.com*/
    mContext = ctx.getApplicationContext();
}

From source file:Main.java

/**
 * Return the app package name//ww  w  .  ja  v a2  s . c  o m
 *
 * @return Return the app package name
 */
public static String getAppPackageName() {
    Context context = getAppContext();
    return context.getPackageName();
}

From source file:Main.java

public static Intent getLaunchIntent(Context context) {
    return getLaunchIntent(context, context.getPackageName());
}

From source file:Main.java

/**
 * @param context/*w w  w.jav a 2s. c  om*/
 * @return
 */
public static SharedPreferences getSharedPreferences(Context context) {
    return context.getSharedPreferences(context.getPackageName(), Activity.MODE_PRIVATE);
}

From source file:Main.java

public static String getAppName(Context context) {
    return getAppName(context, context.getPackageName());
}

From source file:Main.java

public static String getPackageName(final Context context) {
    return context.getPackageName();
}

From source file:Main.java

public static Uri getMargetUri(Context context) {
    return Uri.parse("market://details?id=" + context.getPackageName());
}

From source file:Main.java

@SuppressWarnings("unused")
public static boolean isMainProcess(Context context) {
    return context.getPackageName().equalsIgnoreCase(getProcessName(context));
}

From source file:Main.java

private static Uri getReviewUri(Context context) {
    return Uri.parse("market://details?id=" + context.getPackageName());
}

From source file:Main.java

public static boolean isAppForeground(Context context) {
    return isAppForeground(context, context.getPackageName());
}