Skip to content

Commit

Permalink
clientapp: Android: Target SDK 21 (L)
Browse files Browse the repository at this point in the history
  • Loading branch information
Royna2544 committed Dec 21, 2024
1 parent af88288 commit 0836da9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clientapp/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {

defaultConfig {
applicationId = "com.royna.tgbotclient"
minSdk = 26
minSdk = 21
targetSdk = 35
versionCode = 1
versionName = "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.royna.tgbotclient.pm

import android.Manifest
import android.content.pm.PackageManager
import android.os.Build
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -19,13 +20,18 @@ class StoragePermissionPreR : IStoragePermission {
}

override fun request() {
kActivityRequest.launch(kPermissionsRequested.toTypedArray())
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
kActivityRequest.launch(kPermissionsRequested.toTypedArray())
}
}

override fun isGranted(activity: AppCompatActivity): Boolean {
return kPermissionsRequested.all { permission ->
activity.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
return kPermissionsRequested.all { permission ->
activity.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED
}
}
return true
}

private lateinit var kActivityRequest : ActivityResultLauncher<Array<String>>
Expand Down

0 comments on commit 0836da9

Please sign in to comment.