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:
@@ -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(
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user