【问题标题】:Set Screen Lock Setting in "None"在“无”中设置屏幕锁定设置
【发布时间】:2020-10-15 10:58:19
【问题描述】:

我需要在安卓系统中将屏幕锁定设置设置为“无”。 我正在部署一个应用程序,该应用程序将发送给预配置平板电脑上的用户。 此预配置由平板电脑供应商手动完成。 预配置的设置是在应用安装时将屏幕锁定设置为无。

【问题讨论】:

  • 你认为在电源唤醒锁

标签: android


【解决方案1】:

我认为这是不可能的,用户必须自己做。

考虑到我目前使用的所有应用程序(具有类似要求),将我发送到“选择锁定屏幕”屏幕并要求我手动禁用它。

我可能错了!

【讨论】:

    【解决方案2】:

    试试这个:

        try{
            Class lockPatternUtilsCls = Class.forName("com.android.internal.widget.LockPatternUtils");
            Constructor lockPatternUtilsConstructor =
                    lockPatternUtilsCls.getConstructor(new Class[]{Context.class});
            Object lockPatternUtils = lockPatternUtilsConstructor.newInstance(getContext());
    
            Method setLockScreenDisabled = lockPatternUtils.getClass().getMethod("setLockScreenDisabled", boolean.class ,int.class);
            setLockScreenDisabled.invoke(lockPatternUtils, new Object[]{true,0});
        }
        catch(Exception e){
            Log.e(this.toString(),e.toString());
        }
    

    如果您想更改锁定以滑动:

     setLockScreenDisabled.invoke(lockPatternUtils, new Object[]{false,0});
    

    但您需要将您的应用更改为系统 uid:

    android:sharedUserId="android.uid.system"
    

    【讨论】:

      猜你喜欢
      • 2014-07-20
      • 1970-01-01
      • 2013-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多