Example Time Zone in a Broadcast Receiver

I am trying to implement a time zone change in a broadcast receiver, but its not working. My requirement is that if I change the time zone, it will move on to another action using the broadcast receiver. Can anyone give an example

thank

+3
source share
2 answers

In the declaration:

    <receiver android:name=".TimeZoneChangedReceiver"
        android:enabled="true">
        <intent-filter>
            <action android:name="android.intent.action.TIMEZONE_CHANGED" />
        </intent-filter>
    </receiver>

In your class TimeZoneChangedReceiver:

@Override
public void onReceive(final Context context, final Intent intent) {
    Intent intent = new Intent(....);
    context.startActivity(intent);
}
+8
source

The correct intent filter "android.intent.action.TIMEZONE_CHANGED"(there is no "ACTION_" at the beginning).

+3
source

Source: https://habr.com/ru/post/1762228/


All Articles