读取android手机流量信息(2)
private int intCounter=0;
private int mHour;
private int mMinute;
private int mYear;
private int mMonth;
private int mDay;
private String mdate;
final public String DEV_FILE = "/proc/self/net/dev";//系统流量文件
String[] ethdata={"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"};
String[] gprsdata={"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"};
String[] wifidata={"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"};
String data="0,0,0,0,0,0,0,0,0,0,0,0";//对应on.txt里面的格式
final String ETHLINE=" eth0";//eth是以太网信息 tiwlan0 是 Wifi rmnet0 是 GPRS
final String GPRSLINE="rmnet0";
final String WIFILINE="tiwlan0";
final String TEXT_ENCODING = "UTF-8";
final public String ONPATH = "/data/data/zy.dnh/on.txt";
final public String LOGPATH = "/data/data/zy.dnh/log.txt";
private Runnable mTasks = new Runnable()
{
public void run()//运行该服务执行此函数
{
refresh();
intCounter++;
//DisplayToast("Counter:"+Integer.toString(intCounter));
objHandler.postDelayed(mTasks, 3000);//每3000毫秒执行一次
}
};
@Override
public void onStart(Intent intent, int startId)
{
// TODO Auto-generated method stub
objHandler.postDelayed(mTasks, 0);
super.onStart(intent, startId);
}
@Override
public void onCreate()
{
// TODO Auto-generated method stub
super.onCreate();
}
@Override
public IBinder onBind(Intent intent)
{
// TODO Auto-generated method stub
return null;
}
@Override
public void onDestroy()
{
相关新闻>>
- 发表评论
-
- 最新评论 更多>>