android开发锁屏
㈠ 安卓开发: 锁屏或者黑屏或者后台时,程序暂停运行。不是退出或关闭
估计你是安装了某渗旁个省电软件,一般的省电软件都会让用户设置锁屏后一段野镇时间或者立即清理后台程序,不过它们都有一个不清理的白名丛脊橡单,你可以把不愿被清理的软件拉进去,之后就不会出现锁屏后关闭掉那些你不想关闭的软件。
㈡ Android系统如何开启锁屏功能
开启Android系统的锁屏功能请选择“设置”—》选择“安全性和位置”—》选择“设置解锁图案”:(上述内容仅适用于广东联通用户)
㈢ android如何锁屏
开机自动锁屏。
按电源键手动锁屏。
有的第三方软件支持手动锁屏。
还有默认设置有无操作自动锁屏。
-----------------------------------------------------------------------------
不过我个人感觉,
电容屏的手持设备根本就不需要锁屏。
锁屏对于电容屏设备来说,是影响用户体验的障碍。
㈣ android中怎样调用系统的锁屏功能
要先注册为admin的。相关代码:
mAdminName = new ComponentName(this, MyAdmin.class);
//
public static class MyAdmin extends DeviceAdminReceiver {
// implement onEnabled(), onDisabled(), …
public void onEnabled(Context context, Intent intent) {
Log.d(LOG_TAG, "MyAdmin enabled");
}
public void onDisabled(Context context, Intent intent) {
Log.d(LOG_TAG, "MyAdmin disabled");
}
}
//第一次启动会让你手动去确认
if (!mDPM.isAdminActive(mAdminName)) {
// try to become active – must happen here in this activity,
// to get
// result
Intent intent = new Intent(
DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
mAdminName);
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,
"Additional text explaining why this needs to be added.");
startActivityForResult(intent, 1);
}
//Receiver手动在AndroidManifest.xml里面注册一下
其中添加
<meta-data android:name="android.app.device_admin"
android:resource="@xml/my_admin" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
还有android:permission="android.permission.BIND_DEVICE_ADMIN"
最后:在res下建立/xml/my_admin.xml,内容如下
<?xml version="1.0" encoding="utf-8"?>
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<limit-password />
<watch-login />
<reset-password />
<force-lock />
<wipe-data />
</uses-policies>
</device-admin>
代码的意思在这边就不详细介绍了。如果你写成功的话就一切都明白了。
㈤ android怎么实现我要学霸的强制锁屏功能
android 手机 debug版本(即开发版本,不是发出去生产的版本)
数据线
方法/步骤
我这里介绍的方式是针对手机系统是debug版本的,因为生产版本不让用户自己修改系统的一些参数
先上代码解释清楚原理,点击power按钮,系统会发消息给KeyguardViewMediator,然后消息传递给KeyguardViewManager,然后会掉用show方法,来显示锁屏。具体的创建锁屏view又会调用maybeCreateKeyguardLocked方法,现在来具体看下这个方法
这个方法里的lp.screenOrientation = enableScreenRotation ? ActivityInfo.SCREEN_ORIENTATION_USER : ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;就是在设置锁屏横竖屏。如果enableScreenRotation为true则屏幕根据用户拿手机方式自感应。false反之。我们在这里就是想让enableScreenRotation为true,这样锁屏才能横屏
进一步就看boolean enableScreenRotation = shouldEnableScreenRotation();然后具体看这个shouldEnableScreenRotation方法。容易看到具体的true或者false是根据lockscreen.rot_override和config_enableLockScreenRotation决定的。只要其中一个为true,enableScreenRotation的值就为true。然而config_enableLockScreenRotation的值通过查找为false,这样就需要我们修改lockscreen.rot_override的值为true,来实现目的
但是搜索整个framework代码发现,只有get此值的地方,没有set的地方。后来再看发现,此值是个SystemProperties,于是通过adb shell setprop lockscreen.rot_override也没有找到此系统参数。最后推测谷歌原生代码,并未对此参数进行设置,这也就解释了为什么不能横屏,因为shouldEnableScreenRotation一直返回的值为false。
好了原理就是这样。我们怎么实现横屏呢?就是想发放将lockscreen.rot_override设为true。
首先打开cmd 窗口,adb root 获得手机root权限。adb remount,获得写权限。adb shell setprop lockscreen.rot_override true
ok,大功告成,看效果
㈥ 安卓开发设备管理器,设置锁屏密码
安卓手机设置锁屏密码的方法:
注意:各台设备上的 Android 系统不尽相同。这些说明仅适用于运行 Android 7.0 及以上版本的设备。查看 Android 系统版本参考设置。
1、打开设备的“设置”应用
2、在“个人”下方,点按安全。
3、要更改屏幕锁定设置,请点按“屏幕锁定”旁边的“设置”。具体设置包括自动锁定前的等待时间、电源按钮锁定和锁定屏幕消息。
4、要选择一种屏幕锁定方式,请点按屏幕锁定方式。
- 如果已设置锁定方式,则必须先输入 PIN 码、密码或绘制解锁图案,然后才能选择其他锁定选项。
- 点按想要使用的屏幕锁定选项,然后按照屏幕上的说明操作。
注意:“密码”方式会要求至少输入 4 个字母或数字。只要您能设置一个安全系数高的密码,这就是最安全的选项。
㈦ Android开发设置锁屏壁纸
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
File file = new File("mnt/sdcard2/DCIM/Camera/IMG_20120216_160054.jpg");
Intent intent = createSetAsIntent(Uri.fromFile(file),null);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(intent, "设置壁纸"));
// file:///mnt/sdcard2/DCIM/Camera/IMG_20120216_160054.jpg
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public static Intent createSetAsIntent(Uri uri, String mimeType) {
// Infer MIME type if missing for file URLs.
if (uri.getScheme().equals("file")) {
String path = uri.getPath();
int lastDotIndex = path.lastIndexOf('.');
if (lastDotIndex != -1) {
mimeType = MimeTypeMap.getSingleton()
.getMimeTypeFromExtension(
uri.getPath().substring(lastDotIndex + 1)
.toLowerCase());
}
}
Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
intent.setDataAndType(uri, mimeType);
intent.putExtra("mimeType", mimeType);
return intent;
}