1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +01:00

Added a check to avoid indefinitely lasting scans

This commit is contained in:
TaaviE 2020-01-31 07:01:04 +02:00
parent b321956c7c
commit b01e703e84
2 changed files with 9 additions and 1 deletions

View File

@ -53,6 +53,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -303,7 +304,13 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
registerReceiver(bluetoothReceiver, bluetoothIntents);
startDiscovery();
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
GB.toast(DiscoveryActivity.this, getString(R.string.error_no_location_access), Toast.LENGTH_SHORT, GB.ERROR);
LOG.error("No permission to access coarse location!");
checkAndRequestLocationPermission();
} else {
startDiscovery();
}
}
@Override

View File

@ -777,6 +777,7 @@
<string name="prefs_button_triple_press_action_selection_title">Event 3 action</string>
<string name="prefs_button_variable_actions">Detailed button press settings</string>
<string name="prefs_button_long_press_action_selection_title">Long press button action</string>
<string name="error_no_location_access">Location access must be granted and enabled for scanning to work properly</string>
<plurals name="widget_alarm_target_hours">
<item quantity="one">%d hour</item>
<item quantity="two">%d hours</item>