是否可以更改Android中显示的时间?

时间:2017-08-16 20:41:27

标签: android time

已在各个地方进行了讨论,包括非常详细地here,Android不允许用户应用程序更改系统时间(有充分理由)。

但是,是否可以在不更改系统时间的情况下更改显示给用户的时间(屏幕顶部和解锁屏幕等)?

基本上,用户会看到一次,系统会对所有必要的进程使用不同的(实际)时间。

2 个答案:

答案 0 :(得分:0)

如果您的应用获得了升级权限:

adb shell pm grant com.example.myapp android.permission.DUMP
adb shell settings put global sysui_demo_allowed 1

这可以通过开发人员选项/演示模式功能实现,如QuickDemo开源应用中所示。

您可以查看code那里的操作方法:

Intent intent = Intent("com.android.systemui.demo")
intent.putExtra("command", "clock")
intent.putExtra("hhmm", "1231")
context.sendBroadcast(intent)

来源:https://pspdfkit.com/blog/2016/clean-statusbar-with-systemui-and-quickdemo/

答案 1 :(得分:0)

我不确定@ david的答案,但我几乎肯定你需要root访问权限。可以使用AlarmManager.setTime()

以root身份完成
相关问题