Android APK Information Get getAppPackage(Context context)

Here you can find the source of getAppPackage(Context context)

Description

get App Package

Declaration

public static PackageInfo getAppPackage(Context context) 

Method Source Code

//package com.java2s;

import android.content.Context;

import android.content.pm.PackageInfo;

import android.content.pm.PackageManager.NameNotFoundException;

public class Main {
    public static PackageInfo getAppPackage(Context context) {
        PackageInfo appPackage = null;/*  w ww.  j  av  a  2 s.  co  m*/
        try {
            appPackage = context.getPackageManager().getPackageInfo(
                    context.getPackageName(), 0);
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
        return appPackage;
    }
}

Related

  1. isApplicationBroughtToBackground(Context context)
  2. isApplicationSentToBackground( final Context context)
  3. restoreToUserApp(Context context)
  4. getApplicationName(Context context)
  5. getAppName(Context context)
  6. getAppVersionCode(Context context)
  7. getAppVersionName(Context context)
  8. getApkIcon(Context context, String apkPath)