且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android使方法每X秒运行一次(涉及gps和服务器调用)

更新时间:2022-12-26 14:15:32

Place this in onCreate of a service.

  mTimer.scheduleAtFixedRate(new TimerTask() {
    @Override
    public void run() {
           // What you want to do goes here
         }
    }, 0, REFRESH_TIME);

REFRESH_TIME is the frequency or time in milliseconds when the run repeats itself.

相关阅读

技术问答最新文章