2

I'm updating an Android project which involve updating time based on specified timezone and time (although I know system time may not be changed programmatically). I just stumbled upon this answer: https://stackoverflow.com/a/27540304/2246147 stating:

In your AndroidManifest.xml

<uses-permission android:name="android.permission.SET_TIME_ZONE"/>

Checking the Android developers doc for android.permission.SET_TIME_ZONE, it states that it is:

Not for use by third-party applications.

I would just like to clarify this statement from the Android developer if the setTimezone() would actually really work when it really needs the permission which is stated as not for use for third-party? I would also like to know usages of this permission other than setting the timezone using AlarmManager API

patrickjason91
  • 865
  • 11
  • 20

2 Answers2

0

Yes. It needs permission to run setTimezone(), but Android will not grant you this permission, either through the manifest or at runtime, unless your app is signed with your OS or manufacturer's signing key. In that case, I think you just need it in the manifest, but I've never developed a non-3rd party app, so I don't know.

Check this answer for more details.

Also, this answer (for the same question) has some insight for a workaround (launching the system's date settings activity), which seems to be the best you could hope for for a market app.

timkellypa
  • 61
  • 1
  • 5
-1

I would also like to know usages of this permission other than setting the timezone

None, this is solely for setting the system timezone.

I would just like to clarify this statement from the Android developer if the setTimezone() would actually really work when it really needs the permission which is stated as not for use for third-party?

Would it work for a non-3rd-party application? Yes.
Would it need the permission? Yes.

Do you represent a 3rd-party application? Yes.
Could you get it to work? Perhaps, if it's not properly safeguarded.
Should you try to make it work? No.

Tim
  • 41,901
  • 18
  • 127
  • 145