我正在编写一个应用程序,它应该使用密码进行保护。而不是建立一个新的,是否有可能从不同模式的应用程序使用Android的模式锁定屏幕?重复使用Android锁定模式
3
A
回答
-1
首先,您必须通过手动进入设置来设置模式锁定。 然后你可以使用下面的代码接收事件。 `
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");
}
}
为了完全理解,请阅读此。 Complete Code And Explaination
+1
而不是仅仅提供一个链接,[这将是更可取的](http:// meta .stackoverflow.com/a/8259)在这里包含答案的基本部分,并提供链接以供其他参考。如果你不能完成这个任务,你应该考虑简单地[留下评论](http://stackoverflow.com/privileges/comment)而不是发布答案。 – Dukeling 2014-05-08 20:00:59
+0
对不起,因为有很多代码和解释,所以我给你介绍了一些链接。尝试以上,并告诉我,如果你需要任何帮助 – 2014-05-08 21:24:18
相关问题
- 1. 使用Android模式锁
- 2. 如何在Android中使用模式/密码模式锁定/解锁屏幕?
- 3. 使用preg_match重复模式
- 4. 锁模式为Android
- 5. 使用锁定模式锁定应用程序
- 6. Android Studio,Kiosk模式,单用途设备,锁定任务模式
- 7. 在双重锁定的锁定模式中获取屏障
- 8. 双重锁定锁定模式:是否损坏?
- 9. 以编程方式Android模式锁定/解锁屏幕
- 10. Android中的双重锁定锁定
- 11. 锁定向下(“Kiosk模式”)Android设备
- 12. 锁定Android手机(锁定模式或类似)
- 13. PostgreSQL锁定模式
- 14. 休眠锁定模式/锁定选项
- 15. Emacs:只为mmm模式使用主模式的字体锁定
- 16. 重复模式
- 17. 未锁定自定义阵列适配器中的编辑模式时Android锁定复选框
- 18. Ember干燥模式重复使用“Ember.computed.alias”
- 19. Java中重复使用模式实例
- 20. 使用PHP识别重复模式
- 21. 可重复使用的android样式?
- 22. 通过多个活动重复使用Android AsnycTask的模式?
- 23. Android的布局重复模式
- 24. 重复模式应用re.sub
- 25. 锁定商业模式
- 26. JPA锁定模式行为
- 27. iOS中的模式锁定
- 28. Android应用程序和模式锁定屏幕
- 29. 使用双重检查锁定习惯用于单身模式是否最佳?
- 30. AlarmManager - 重复模式
[检查此锁定模式库。](http://androidcustomviews.com/portfolio/android-lock-pattern/) – 2013-08-08 09:27:25