我正在制作一个应用程序,该应用程序希望从后端阻止设备并在锁定屏幕上显示一条消息:
我可以阻止设备但不显示消息
我一直在从android开发人员页面引导我: https://developer.android.com/reference/kotlin/android/app/admin/DevicePolicyManager
private DevicePolicyManager devicePolicyManager;
private ComponentName compName;
onCreate()
devicePolicyManager = (DevicePolicyManager) getSystemService(DEVICE_POLICY_SERVICE);
compName = new ComponentName(this, DeviceAdministrator.class);
onClick事件
devicePolicyManager.lockNow();
我尝试了
devicePolicyManager.setLongSupportMessage(compName, "Lorem Ip");
和
devicePolicyManager.setDeviceOwnerLockScreenInfo(compName, "Lorem Ip");