Code example for DevicePolicyManager

Methods: isAdminActive, wipeData

0
                AlertDialog.Builder builder = new AlertDialog.Builder(Controller.this); 
                builder.setMessage("This will erase all of your data.  Are you sure?"); 
                builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { 
                    public void onClick(DialogInterface dialog, int which) { 
                        AlertDialog.Builder builder = new AlertDialog.Builder(Controller.this); 
                        if (v == mWipeAllDataButton) { 
                            builder.setMessage("This is not a test.  " 
                                    + "This WILL erase all of your data, " 
                                    + "including external storage!  " 
                                    + "Are you really absolutely sure?"); 
                        } else { 
                            builder.setMessage("This is not a test.  " 
                                    + "This WILL erase all of your data!  " 
                                    + "Are you really absolutely sure?"); 
                        } 
                        builder.setPositiveButton("BOOM!", new DialogInterface.OnClickListener() { 
                            public void onClick(DialogInterface dialog, int which) { 
                                boolean active = mDPM.isAdminActive(mDeviceAdminSample); 
                                if (active) { 
                                    mDPM.wipeData(v == mWipeAllDataButton 
                                            ? DevicePolicyManager.WIPE_EXTERNAL_STORAGE : 0);