List of usage examples for android.content.pm ApplicationInfo FLAG_DEBUGGABLE
int FLAG_DEBUGGABLE
To view the source code for android.content.pm ApplicationInfo FLAG_DEBUGGABLE.
Click Source Link
From source file:Main.java
public static boolean isDebug(Context context) { PackageManager pm = context.getPackageManager(); try {//from w w w . j av a 2s . c o m ApplicationInfo applicationInfo = pm.getApplicationInfo(context.getPackageName(), 0); return (applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; } catch (NameNotFoundException e) { e.printStackTrace(); } return false; }
From source file:Main.java
/** * Checks if the application is running as debug mode or not. * @param app the application to check/*from ww w . j a v a 2 s.c o m*/ * @return true if debuggable, false otherwise. */ public static final boolean isDebuggable(Application app) { ApplicationInfo info = app.getApplicationInfo(); return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; }
From source file:Main.java
/** * Check whether the application is debuggable. * The first check is to see what the PackageManager reports. * If wanted, an additional check can be performed by looking at the certificate. * The default auto-generated certificate has the DN 'CN=Android Debug,O=Android,C=US', * as described at http://developer.android.com/tools/publishing/app-signing.html#debugmode * If the app's DN matches this default, it is probably using the debug certificate. * * @param context Context// ww w. j av a 2 s . c o m * @return true when the app is debuggable, otherwise false */ public static boolean isDebuggable(final Context context, final boolean includeDefaultDebugCertificateCheck) { boolean debuggable = (0 != (context.getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)); if (!debuggable && includeDefaultDebugCertificateCheck) { debuggable = isDebugCertificateCheck(context); } return debuggable; }
From source file:Main.java
public static boolean isLocalBuild(Context context) { boolean localVersionCode = false; try {//from w w w. j ava 2 s. c om PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); localVersionCode = packageInfo.versionCode == 1; } catch (PackageManager.NameNotFoundException ignored) { } return 0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) && localVersionCode; }
From source file:Main.java
/** * Judge whether an app is dubuggable by package name * * @param context/*from w w w . j a v a2 s . co m*/ * @param packageName * @return */ public static boolean isApkDebugable(Context context, String packageName) { try { PackageInfo pkginfo = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); if (pkginfo != null) { ApplicationInfo info = pkginfo.applicationInfo; return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; } } catch (Exception e) { } return false; }
From source file:Main.java
public static void setupLogcatLogs(ApplicationInfo appInfo) { if (0 != (appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE)) { File f = new File(Environment.getExternalStorageDirectory(), "rockscout_logs"); if (!f.exists()) { f.mkdirs();/* w w w . jav a 2 s.c o m*/ } String filePath = Environment.getExternalStorageDirectory() + String.format("/rockscout_logs/logcat_%s.txt", Calendar.getInstance().getTime().toString()); try { Runtime.getRuntime().exec(new String[] { "logcat", "-v", "time", "-f", filePath }); } catch (IOException e) { } } }
From source file:Main.java
/** * Determines if the application has been compiled with debugging enabled. * * @param context {@link Context} used to access the {@link ApplicationInfo}. * * @return true if debugging is enabled, otherwise false. *//* w ww.j ava 2 s. c o m*/ @SuppressWarnings("BooleanMethodIsAlwaysInverted") public static boolean isDebuggable(final Context context) { return context == null || context.getApplicationInfo() == null || (0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)); }
From source file:nl.frankkie.bronylivewallpaper.CLog.java
public static boolean checkDebuggable(Context c) { return (0 != (c.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)); }
From source file:it.mb.whatshare.Utils.java
/** * Checks whether the app that's running has the * <code>android:debuggable</code> flag set, and enables/disables all log * calls accordingly./* w ww. j a v a 2s.c om*/ * * @param context * the caller activity */ public static void checkDebug(Context context) { if (!debuggableFlagChecked) { debuggableFlagChecked = true; PackageManager manager = context.getPackageManager(); try { PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0); debugEnabled = (info.applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; } catch (NameNotFoundException e) { e.printStackTrace(); // let's keep debug disabled } } // else it's already been checked once, don't check anymore }
From source file:upv.welcomeincoming.app.ARViewActivity.java
@SuppressLint("NewApi") @Override//from www . j a v a 2 s .c o m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_architect_view); getActionBar().setDisplayHomeAsUpEnabled(true); //Wikitude: Cambio en WebView para Android KitKat if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)) { WebView.setWebContentsDebuggingEnabled(true); } } // establecer AR-view this.architectView = (ArchitectView) this.findViewById(R.id.architectView); //Inicializar clave de Wikitude SDK (si se posee) // (en caso contrario, aparece una marca de agua en la architectView) final ArchitectConfig config = new ArchitectConfig("" /* license key */ ); this.architectView.onCreate(config); // listener del locationProvider, maneja los cambios de localizacion this.locationListener = new LocationListener() { @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public void onProviderEnabled(String provider) { } @Override public void onProviderDisabled(String provider) { } @Override public void onLocationChanged(final Location location) { if (location != null) { // establecer ultima localizacion ARViewActivity.this.lastKnownLocaton = location; if (ARViewActivity.this.architectView != null) { // chequeamos si la localizacion tiene altitud a un determinado nivel de exactitud (para invocar al metodo adecuado en la ARView) if (location.hasAltitude() && location.hasAccuracy() && location.getAccuracy() < 7) { ARViewActivity.this.architectView.setLocation(location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getAccuracy()); } else { ARViewActivity.this.architectView.setLocation(location.getLatitude(), location.getLongitude(), location.hasAccuracy() ? location.getAccuracy() : 1000); } } } } }; // locationProvider this.locationProvider = new LocationProvider(this, this.locationListener); }