sforkowany z mirror/meshtastic-android
fix compatibility with older androids
rodzic
2401b3d0b3
commit
69983f18a9
|
@ -5,6 +5,7 @@ import android.bluetooth.BluetoothAdapter
|
||||||
import android.bluetooth.BluetoothManager
|
import android.bluetooth.BluetoothManager
|
||||||
import android.content.*
|
import android.content.*
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
|
@ -49,15 +50,17 @@ class MainActivity : AppCompatActivity(), Logging,
|
||||||
private fun requestPermission() {
|
private fun requestPermission() {
|
||||||
debug("Checking permissions")
|
debug("Checking permissions")
|
||||||
|
|
||||||
val perms = arrayOf(
|
val perms = mutableListOf(
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||||
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
|
|
||||||
Manifest.permission.BLUETOOTH,
|
Manifest.permission.BLUETOOTH,
|
||||||
Manifest.permission.BLUETOOTH_ADMIN,
|
Manifest.permission.BLUETOOTH_ADMIN,
|
||||||
Manifest.permission.WAKE_LOCK,
|
Manifest.permission.WAKE_LOCK,
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 29) // only added later
|
||||||
|
perms.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
|
||||||
|
|
||||||
val missingPerms = perms.filter {
|
val missingPerms = perms.filter {
|
||||||
ContextCompat.checkSelfPermission(
|
ContextCompat.checkSelfPermission(
|
||||||
this,
|
this,
|
||||||
|
|
Ładowanie…
Reference in New Issue