2012-04-07 150 views
0

我在做项目的Android ..如何获得位置进行一定的时间间隔

我想获得一定的时间间隔位置(固定时间)按钮被点击

为前时:每10分钟4小时我想获得当前位置地址。

如何得到它?有没有像Visual Basic一样的定时器控件?或任何其他方法来做到这一点。 thax提前

回答

0
LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); 

LocationListener mlocListener = new MyLocationListener(context); 

mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1, 1,mlocL istener); 

// 语法: mlocManager.requestLocationUpdates(provider,minTime,minDistance,listener)

您可以设置时间和距离都在这个方法中看到的部份语法

相关问题