add hasGpsSensor check

pull/323/head
andrekir 2021-12-15 12:02:01 -03:00
rodzic e21f3fdf93
commit c53179c090
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -11,6 +11,7 @@ import android.companion.AssociationRequest
import android.companion.BluetoothDeviceFilter
import android.companion.CompanionDeviceManager
import android.content.*
import android.content.pm.PackageManager
import android.hardware.usb.UsbDevice
import android.hardware.usb.UsbManager
import android.os.Bundle
@ -908,8 +909,12 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
* If the user has not turned on location access throw up a toast warning
*/
private fun checkLocationEnabled() {
fun hasGpsSensor(): Boolean =
myActivity.packageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)
// If they don't have google play FIXME for now we don't check for location access
if (isGooglePlayAvailable(requireContext())) {
if (hasGpsSensor() && isGooglePlayAvailable(requireContext())) {
// We do this painful process because LocationManager.isEnabled is only SDK28 or latet
val builder = LocationSettingsRequest.Builder()
builder.setNeedBle(true)