禁用Android应用上的位置关闭

时间:2017-09-27 11:11:32

标签: android location bluetooth-lowenergy

在我正在处理的Andorid应用程序上,需要扫描BLE设备,并且请求这样做是为了启用位置。我是按照Google here描述的方法完成的。

因为我只需要启用该位置,但实际上不需要从中获取任何数据,而不是使用

protected void createLocationRequest() {
    LocationRequest mLocationRequest = new LocationRequest();
    mLocationRequest.setInterval(10000);
    mLocationRequest.setFastestInterval(5000);
    mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}

我只使用

protected void createLocationRequest() {
    LocationRequest mLocationRequest = new LocationRequest();
    mLocationRequest.setPriority(LocationRequest.PRIORITY_LOW_POWER);
}

这很好。

我的问题是,一旦用户离开应用,我该如何 停用 该位置。

0 个答案:

没有答案