is Application in Debug Model - Android android.content.pm

Android examples for android.content.pm:PackageManager

Description

is Application in Debug Model

Demo Code

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.util.Log;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main{

    private final static String TAG = "SystemUtil";
    public static boolean isDebugModel(Context context) {
        PackageManager mgr = context.getPackageManager();
        try {//from   www. j  a  va 2s  .  c  o m
            ApplicationInfo info = mgr.getApplicationInfo(
                    context.getPackageName(), 0);
            return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) == ApplicationInfo.FLAG_DEBUGGABLE;
        } catch (NameNotFoundException e) {
            Log.e(TAG, e.getMessage(), e);
        }
        return false;
    }

}

Related Tutorials