0

I'm developing an app that saves some data when system date changes.
I tried to use a BroadcastReceiver to receive the Intent android.intent.action.DATE_CHANGED, but for some reason it doesn't work.

Here is my code for the Receiver:

public class BroadcastDateChangedReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {

        if (intent.getAction().equals("android.intent.action.DATE_CHANGED")) {

            Toast.makeText(context, "Date changed", Toast.LENGTH_LONG).show();

        }
    }
}

In AndroidManifest.xml:

<receiver android:name=".BroadcastDateChangedReceiver">
    <intent-filter>
        <action android:name="android.intent.action.DATE_CHANGED"/>
    </intent-filter>
</receiver>

When I change the system date (either manually or it changes automatically) the Toast doesn't appear.

What is wrong with my code?
Should I use a different approach to determine a system date change?

dzikovskyy
  • 5,027
  • 3
  • 32
  • 43

1 Answers1

0


This bug is obsolete. See this link
Some research and variants in this link

Community
  • 1
  • 1
xoxol_89
  • 1,242
  • 11
  • 17