0

The thread talking about this subject is back from '10, so I don't know if things have changed or not.

How to set mobile system time and date in android?

What I desire to do is make an app that "distorts time". By this I mean the user downloads it, flicks a switch, and your clock at the top of the screen gradually begins to make time go slower and slower. That part I have understand how to do, but I was wondering if there was a way the user could give access to my app this sort of permission to change the clock (or at least what the clock at the top of the screen says) on it's own.

I'm unfamiliar with a lot of this stuff, and am not sure whether sort of data is manipulable or not.

1 Answers1

0

From the Oreo source,

   <!-- @SystemApi Allows applications to set the system time.
    <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.SET_TIME"
        android:protectionLevel="signature|privileged" />

Looks like you cannot be granted that permission unless you are signed with the platform key (are part of the firmware).

Also note you'd need to toggle off automatic time updates.

This app sounds like a really bad idea. Does the user want their calendar notifications to start going off at the wrong time, or not go off because the time is incorrect? Changing the time is going to cause many things to malfunction. If it gets too far off the device won't be able to make SSL connections.

Jeffrey Blattman
  • 22,176
  • 9
  • 79
  • 134
  • So unless I went through Android and became an official part of the phone software I couldn't? – Jackson Ennis Feb 22 '18 at 00:25
  • Dang. Thanks for the help. The app was intended to help insomniacs sleep better. You would flip a switch, and your display clock at the top of the screen would change minutes slower and slower, so it would seem like you were going to sleep sooner. It'd revert to the actual time after 3 hours, but that way, subconsciously you'd feel like you'd gotten more sleep than you actually had. In theory, anyways. – Jackson Ennis Feb 22 '18 at 00:36
  • Maybe you could build an "insomniac alarm clock" app that just shows a local, manipulated clock. It could be full screen to prevent the system bar time from showing. Anyway, good luck. – Jeffrey Blattman Feb 22 '18 at 00:41