mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-18 14:31:23 +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);
|
LocationManager locationManager = (LocationManager)context.getSystemService(LOCATION_SERVICE);
|
||||||
|
|
||||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION)
|
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");
|
Timber.d("Do LE scan before connecting to device");
|
||||||
scanSubscription = bleClient.scanBleDevices(
|
scanSubscription = bleClient.scanBleDevices(
|
||||||
|
@@ -87,7 +87,7 @@ public class PermissionHelper {
|
|||||||
|
|
||||||
public static boolean requestLocationServicePermission(final Activity activity) {
|
public static boolean requestLocationServicePermission(final Activity activity) {
|
||||||
LocationManager locationManager = (LocationManager) activity.getSystemService(LOCATION_SERVICE);
|
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);
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||||
builder.setTitle(R.string.permission_bluetooth_info_title);
|
builder.setTitle(R.string.permission_bluetooth_info_title);
|
||||||
|
Reference in New Issue
Block a user