kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
add hasGpsSensor check
rodzic
e21f3fdf93
commit
c53179c090
|
@ -11,6 +11,7 @@ import android.companion.AssociationRequest
|
||||||
import android.companion.BluetoothDeviceFilter
|
import android.companion.BluetoothDeviceFilter
|
||||||
import android.companion.CompanionDeviceManager
|
import android.companion.CompanionDeviceManager
|
||||||
import android.content.*
|
import android.content.*
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.hardware.usb.UsbDevice
|
import android.hardware.usb.UsbDevice
|
||||||
import android.hardware.usb.UsbManager
|
import android.hardware.usb.UsbManager
|
||||||
import android.os.Bundle
|
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
|
* If the user has not turned on location access throw up a toast warning
|
||||||
*/
|
*/
|
||||||
private fun checkLocationEnabled() {
|
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 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
|
// We do this painful process because LocationManager.isEnabled is only SDK28 or latet
|
||||||
val builder = LocationSettingsRequest.Builder()
|
val builder = LocationSettingsRequest.Builder()
|
||||||
builder.setNeedBle(true)
|
builder.setNeedBle(true)
|
||||||
|
|
Ładowanie…
Reference in New Issue