set Debuggable - Android android.provider

Android examples for android.provider:Settings

Description

set Debuggable

Demo Code


//package com.java2s;

import android.annotation.SuppressLint;

import android.content.Context;

import android.provider.Settings;

public class Main {
    @SuppressLint("InlinedApi")
    public static void setDebuggable(Context context, boolean debuggable) {
        Settings.Global.putInt(context.getContentResolver(),
                Settings.Global.ADB_ENABLED, debuggable ? 1 : 0);
        Settings.Global.putInt(context.getContentResolver(),
                Settings.Global.DEVELOPMENT_SETTINGS_ENABLED,
                debuggable ? 1 : 0);/*  w  w  w  .j ava2s  . c o m*/
    }
}

Related Tutorials