1

It's been discussed in various places including in much detail here that Android does not permit user applications to change system time (with good reason).

However, would it be possible to change the time displayed to the user (top of the screen and unlock screen etc), without changing the system time?

Basically, the user would see one time and the system would use a different (actual) time for all the necessary processes.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141

2 Answers2

0

If your app is granted escalated permissions:

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

this is possible through the Developer Options / Demo mode feature as demonstrated in the QuickDemo open source app.

You can check the code there for how to do it:

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

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

David Rawson
  • 20,912
  • 7
  • 88
  • 124
0

I'm not sure about @david's answer but I'm nearly certain you need root access. It can been done with root using AlarmManager.setTime()

AnthonyK
  • 473
  • 2
  • 11