Change of date and time android

-1

Someone knows how I could know when someone has changed the date and time of an Android phone. Is it to say get some log or show some notification? Thanks in advance

    
asked by ScorpJr 31.10.2017 в 18:05
source

1 answer

-1

You can do it with a BroadcastReceiver

public class ReceiverFechaHora extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Toast.makeText(context, "cambio fecha/hora", Toast.LENGTH_LONG).show();
        //Logica del negocio
    }
}

and you register it in your file AndroidManifest.xml with the filter android.intent.action.TIME_SET

<receiver
    android:name=".ReceiverFechaHora">
    <intent-filter>
        <action android:name="android.intent.action.TIME_SET" />
    </intent-filter>
</receiver>
    
answered by 31.10.2017 в 18:57