I am writing a application and it should be protected with a password. Instead of building a new one, Is it possible to use the Android's Pattern lock screen from application with different patterns?
Asked
Active
Viewed 2,803 times
1 Answers
-1
First you have to setup the Pattern Lock by going into setting manually . then you can receive the events using code below . `
import android.app.admin.DeviceAdminReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;
public class DemoDeviceAdminReceiver extends DeviceAdminReceiver {
static final String TAG = "DemoDeviceAdminReceiver";
/** Called when this application is approved to be a device administrator. */
@Override
public void onEnabled(Context context, Intent intent) {
super.onEnabled(context, intent);
Toast.makeText(context, R.string.device_admin_enabled,
Toast.LENGTH_LONG).show();
Log.d(TAG, "onEnabled");
}
/** Called when this application is no longer the device administrator. */
@Override
public void onDisabled(Context context, Intent intent) {
super.onDisabled(context, intent);
Toast.makeText(context, R.string.device_admin_disabled,
Toast.LENGTH_LONG).show();
Log.d(TAG, "onDisabled");
}
@Override
public void onPasswordChanged(Context context, Intent intent) {
super.onPasswordChanged(context, intent);
Log.d(TAG, "onPasswordChanged");
}
@Override
public void onPasswordFailed(Context context, Intent intent) {
super.onPasswordFailed(context, intent);
Log.d(TAG, "onPasswordFailed");
}
@Override
public void onPasswordSucceeded(Context context, Intent intent) {
super.onPasswordSucceeded(context, intent);
Log.d(TAG, "onPasswordSucceeded");
}
}
For Complete understanding please read this . Complete Code And Explaination
-
1Rather than just providing a link, [it would be preferable](http://meta.stackoverflow.com/a/8259) to include the essential parts of the answer here, and just provide the link for additional reference. If you're not up to this task, you should consider simply [leaving a comment](http://stackoverflow.com/privileges/comment) on the question instead of posting an answer. – Bernhard Barker May 08 '14 at 20:00
-
Sorry As there was A lot code and explanation so i referred you some links. try above and tell me if you need any help – Sahibzada Muhammad Junaid Khan May 08 '14 at 21:24