Pra*_*dam 2 android android-service android-location
我想在我的应用程序启动时启用GPS 30秒(当oncreate()方法调用时).30秒后转为禁用模式.
试试这段代码,
LocationManager locationManager =(LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER, WLConstants.DELAY_HOUR, gpsl
.getMinDistance(), gpsl);
Run Code Online (Sandbox Code Playgroud)
并停止GPS尝试
locationManager.removeUpdates(gpsl);
Run Code Online (Sandbox Code Playgroud)
在你完成你的时间段之后给这个.
| 归档时间: |
|
| 查看次数: |
1015 次 |
| 最近记录: |