mirror of
https://github.com/etesync/android
synced 2024-11-21 23:48:11 +00:00
Fix no permission to import from file (#254)
* Fix no permission to import from file for Android 13+ * Made changes and successfully tested fixing no permission to import from file for Android 13+
This commit is contained in:
parent
425c637ead
commit
00425eb281
@ -36,8 +36,9 @@
|
||||
-->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
|
||||
|
||||
<!-- Used for external log and vcf import. -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<!-- Used for external log and vcf import. Permissions changed for SDK >= 33. -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
|
||||
|
||||
<!-- other permissions -->
|
||||
<!-- android.permission-group.CONTACTS -->
|
||||
|
@ -10,6 +10,7 @@ import android.content.ActivityNotFoundException
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Bundle
|
||||
import android.provider.CalendarContract
|
||||
import android.provider.ContactsContract
|
||||
@ -63,7 +64,11 @@ class ImportFragment : DialogFragment() {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
private fun requestPermissions() {
|
||||
requestPermissions(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), 0)
|
||||
if (SDK_INT <= 32) {
|
||||
requestPermissions(kotlin.arrayOf(android.Manifest.permission.READ_EXTERNAL_STORAGE), 0)
|
||||
} else {
|
||||
requestPermissions(arrayOf(Manifest.permission.READ_MEDIA_IMAGES), 0)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
|
Loading…
Reference in New Issue
Block a user