zoukankan      html  css  js  c++  java
  • 监听手机状态 网络,电话,位置等等~

    mPhone = (TelephonyManager) this
                    .getSystemService(Context.TELEPHONY_SERVICE);
            mPhone.listen(mPhoneStateListener,
                    PhoneStateListener.LISTEN_SERVICE_STATE
                            | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
                            | PhoneStateListener.LISTEN_DATA_ACTIVITY);
    
    mPhoneStateListener = new PhoneStateListener() {
    
            @Override
            public void onDataActivity(int direction) {
                super.onDataActivity(direction);
                Log.v("kevin", "onDataActivity: " + direction);
            }
    
            @Override
            public void onDataConnectionStateChanged(int state) {
                super.onDataConnectionStateChanged(state);
                if(state == TelephonyManager.DATA_DISCONNECTED){
                    Log.v("kevin", "onDataConnectionStateChanged: " + state);
                }
            }
    
            @Override
            public void onServiceStateChanged(ServiceState serviceState) {
                super.onServiceStateChanged(serviceState);
                Log.v("kevin", "onServiceStateChanged");
            }
    
        };
    
  • 相关阅读:
    删掉从svn 文件夹里复制出来所带的信息(去掉.svn文件夹)
    AS3 loader
    as3鼠标事件
    linux 随机数
    AS3资源处理
    字符串合并
    linux time.h
    fat32转ntfs
    linux 杂项
    oracle——创建数据表
  • 原文地址:https://www.cnblogs.com/yangzhenyu/p/2395191.html
Copyright © 2011-2022 走看看