无意间在微博上看到关于土豪体验器的幽默端子,所以也搞搞。http://tieba.baidu.com/p/2784958458
主要工作就是后台定时往收件箱里写任何内容的短信
1.往收件箱里写短信
1.核心代码:
http://blog.sina.com.cn/s/blog_9935b660010115yt.html
2.定时器
Handler handler=new Handler();
Runnable runnable=new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
//要做的事情
Log.i(TAG, "the timer is runing ===== running>");
handler.postDelayed(this, 2000*30*5);
}
};
// handler.postDelayed(runnable, 2000*30*5);启动定时器
3.写短信时手机振动
Vibrator mVibrator = (Vibrator)getApplication().getSystemService(Service.VIBRATOR_SERVICE);//获取振动器
mVibrator.vibrate(new long[] { 100, 10, 100, 1000 },-1);//控制震动周期,repeat=-1时,震动只出现一次;repeat=0时,震动一直持续,必须手动取消
要加入权限
<uses-permission android:name="android.permission.VIBRATE" />
4.后台server
关于server的应用http://www.cnblogs.com/allin/archive/2010/05/15/1736458.html
在华为手机上测试成功。
代码http://download.csdn.net/detail/gaobobo138968/6839885