Java tutorial
//package com.java2s; import android.content.Context; import android.content.pm.PackageManager; public class Main { private static Context mContext; /** * Gets record audio permission. * * @return the record audio permission */ public static boolean getRecordAudioPermission() { return PackageManager.PERMISSION_GRANTED == mContext.getPackageManager() .checkPermission("android.permission.RECORD_AUDIO", getAppPackageName()); } /** * Gets app package name. * * @return the app package name */ public static String getAppPackageName() { return mContext.getPackageName(); } }