mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-29 03:55:49 +01:00
Added a check to avoid indefinitely lasting scans
This commit is contained in:
parent
b321956c7c
commit
b01e703e84
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user