Is there a way to detect when the user has changed the clock time on their device?

前端 未结 5 1130

Is there a way to detect when the Android system clock has been reset by the user in Android?

I\'m designing an app which uses system time to determ

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 03:13

    We can use both TIME_SET and TIMEZONE_CHANGED.

    
    
        
            
                
                
            
        
    
    

    TimeChangedReceiver.java

    public class TimeChangedReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
            Toast.makeText(context, "time change " + intent.getAction(), Toast.LENGTH_SHORT).show();
        }
    }
    

提交回复
热议问题