소스 검색

lower midSdkVersion to 21 via hack

Noah Vogt 1 년 전
부모
커밋
d614bf4382
3개의 변경된 파일14개의 추가작업 그리고 9개의 파일을 삭제
  1. 1 1
      app/build.gradle
  2. 11 6
      app/src/main/java/net/folivo/android/smsGatewayServer/MainActivity.kt
  3. 2 2
      build.gradle

+ 1 - 1
app/build.gradle

@@ -18,7 +18,7 @@ android {
 
     defaultConfig {
         applicationId "net.folivo.android.smsGatewayServer"
-        minSdkVersion 27
+        minSdkVersion 21
         targetSdkVersion 29
         versionCode 1
         versionName "1.0"

+ 11 - 6
app/src/main/java/net/folivo/android/smsGatewayServer/MainActivity.kt

@@ -130,17 +130,18 @@ class MainActivity : AppCompatActivity() {
 
         findViewById<AppCompatImageButton>(R.id.buttonCertificate).setOnClickListener {
 
-            if (storagePermissionGranted()) {
+            // if (Companion.storagePermissionGranted(this)) {
                 // Choose a directory using the system's file picker.
                 val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
                     addCategory(Intent.CATEGORY_OPENABLE)
                     type = "application/x-pkcs12"
                 }
                 certificateResultLauncher.launch(intent)
-
+            /*
             } else {
                 storagePermissionResultLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE)
             }
+            */
         }
 
         findViewById<SwitchCompat>(R.id.switchStartServer).setOnCheckedChangeListener { viewButton, isChecked ->
@@ -304,10 +305,6 @@ class MainActivity : AppCompatActivity() {
         }
     }
 
-    private fun storagePermissionGranted(): Boolean {
-        return checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
-    }
-
 
     private fun isDefaultSmsApp(): Boolean {
         return this.packageName == Telephony.Sms.getDefaultSmsPackage(this)
@@ -371,4 +368,12 @@ class MainActivity : AppCompatActivity() {
         }
         return true
     }
+
+    /*
+    companion object {
+        private fun storagePermissionGranted(mainActivity: MainActivity): Boolean {
+            return mainActivity.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
+        }
+    }
+     */
 }

+ 2 - 2
build.gradle

@@ -3,7 +3,7 @@ buildscript {
     ext.kotlin_version = "1.4.10"
     repositories {
         google()
-        jcenter()
+        mavenCentral()
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:4.2.0'
@@ -17,7 +17,7 @@ buildscript {
 allprojects {
     repositories {
         google()
-        jcenter()
+        mavenCentral()
     }
 }