diff --git a/app/build.gradle b/app/build.gradle index 0448d24..c5a50aa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -68,6 +68,7 @@ dependencies { implementation 'androidx.vectordrawable:vectordrawable:1.1.0' implementation 'androidx.preference:preference:1.2.0' + implementation 'com.github.quickpermissions:quickpermissions-kotlin:0.4.0' implementation 'com.hypertrack:hyperlog:0.0.10' implementation 'com.squareup.picasso:picasso:2.71828' implementation 'io.noties.markwon:core:4.6.2' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e398f1c..37f4a2a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,6 +6,8 @@ + + Unit) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + // Android 13 and above + runWithPermissions( + Manifest.permission.SCHEDULE_EXACT_ALARM, + Manifest.permission.POST_NOTIFICATIONS, + callback = action + ) + } else { + // Android 12 and Android 12L + runWithPermissions(Manifest.permission.SCHEDULE_EXACT_ALARM, callback = action) + } + } else { + // Android 11 and below + action() + } + } } diff --git a/build.gradle b/build.gradle index e8dddf7..d8ddb3f 100644 --- a/build.gradle +++ b/build.gradle @@ -27,6 +27,7 @@ allprojects { repositories { google() jcenter() + maven { url "https://jitpack.io/" } } }