1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-17 22:11:35 +02:00

enabled network provider for the location service is also ok for searching Bluetooth devices

This commit is contained in:
oliexdev
2019-02-03 18:49:55 +01:00
parent c443c5c4ea
commit d5a119a117
2 changed files with 3 additions and 2 deletions

View File

@@ -484,7 +484,8 @@ public abstract class BluetoothCommunication {
LocationManager locationManager = (LocationManager)context.getSystemService(LOCATION_SERVICE);
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION)
== PackageManager.PERMISSION_GRANTED && locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
== PackageManager.PERMISSION_GRANTED && (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
|| locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
) {
Timber.d("Do LE scan before connecting to device");
scanSubscription = bleClient.scanBleDevices(

View File

@@ -87,7 +87,7 @@ public class PermissionHelper {
public static boolean requestLocationServicePermission(final Activity activity) {
LocationManager locationManager = (LocationManager) activity.getSystemService(LOCATION_SERVICE);
if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
if (!(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.permission_bluetooth_info_title);