1.  监听时区变化:

配置:

                                                
private static final String ACTION_TIMEZONE_CHANGED = Intent.ACTION_TIMEZONE_CHANGED;@Override    public void onReceive(Context context, Intent intent) {        if (DBG) {            Log.d(LOG_TAG, "---onReceive() start!---");        }        String action = intent.getAction();        if (ACTION_TIMEZONE_CHANGED.equals(action)) {            if (DBG) {                Log.d(LOG_TAG, "---TIMEZONE_CHANGED!---");            }        }        if (DBG) {            Log.d(LOG_TAG, "---onReceive() end!---");        }    }

 

2.  监听日期变化

配置:

                       
private static final String ACTION_DATE_CHANGED = Intent.ACTION_DATE_CHANGED;@Override    public void onReceive(Context context, Intent intent) {        if (DBG) {            Log.d(LOG_TAG, "---onReceive() start!---");        }        String action = intent.getAction();        if (ACTION_DATE_CHANGED.equals(action)) {            if (DBG) {                Log.d(LOG_TAG, "---DATE_CHANGED!---");            }        }                if (DBG) {            Log.d(LOG_TAG, "---onReceive() end!---");        }    }

 

3.  监听时间变化

配置:

                       
private static final String ACTION_DATE_CHANGED = Intent.ACTION_DATE_CHANGED;    private static final String ACTION_TIME_CHANGED = Intent.ACTION_TIME_CHANGED;@Override    public void onReceive(Context context, Intent intent) {        if (DBG) {            Log.d(LOG_TAG, "---onReceive() start!---");        }        String action = intent.getAction();        if (ACTION_DATE_CHANGED.equals(action)) {            if (DBG) {                Log.d(LOG_TAG, "---DATE_CHANGED!---");            }        }        if (ACTION_TIME_CHANGED.equals(action)) {            if (DBG) {                Log.d(LOG_TAG, "---TIME_CHANGED!---");            }        }                if (DBG) {            Log.d(LOG_TAG, "---onReceive() end!---");        }    }

说明:

1.配置,可同时监听日期,时间的变化。
2.单独监听时间变化的配置,目前不了解。
3.配置中还可,代码中可
private static final String ACTION_TIME_TICK = Intent.ACTION_TIME_TICK;if (ACTION_TIME_TICK.equals(action)) {            if (DBG) {                Log.d(LOG_TAG, "---TIME_TICK!---");            }        }

此功能目前还不清楚用法。

更多相关文章

  1. 仿微信摇一摇功能,android 重力感应开发
  2. 转化为当前的日期和时间
  3. 仿微信摇一摇功能,android 重力感应开发
  4. Android(安卓)监听wifi广播的两种方式
  5. Android/Java面试题收集
  6. android简单的日期时间选择器
  7. Andoid - 开发实例(2): ViewPager卡片式界面2
  8. Android(安卓)扫描SDCard上的音乐文件以及监听扫描事件
  9. Android:通过WifiManager监听Wifi信号强弱

随机推荐

  1. android 图标在eclipse中不显示
  2. android如何查看app的内存占用情况
  3. 【原创】Android学习历程..持续中
  4. Android中ContextMenu用法实例
  5. Android拓展系列(9)--Android视频录制scr
  6. android绘制几何图形
  7. EditText 光标不显示问题
  8. android拍照上传的效果是如何实现的
  9. Android开发问题 - Some projects cannot
  10. Android(安卓)生成不同服务器配置,不同APP