Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I notice time zone changes in Android?

One can listen for all kind of configuration changes by configuring android:configChanges in the AndroidManifest.xml and act accordingly in the activity's onConfigrationChanged method (Android docs).

What I didn't find so far is however a handler that acts on time zone changes. This could for example happen if the user often crosses time zones after a journey and wants to see his application contents in the local time of the country where he's in.

Is the only possibility I have here really to check TimeZone.getDefault() regularily myself and adapt my times accordingly?

like image 973
Thomas Keller Avatar asked Dec 21 '22 13:12

Thomas Keller


1 Answers

Listen for the broadcasted Intent: android.intent.action.TIMEZONE_CHANGED

like image 168
RvdK Avatar answered Jan 04 '23 00:01

RvdK