From 2fa1474caa009cdc456aaf9afe3c15b65a5063ae Mon Sep 17 00:00:00 2001 From: sadorowo Date: Thu, 13 Jun 2024 09:44:42 +0200 Subject: [PATCH] fix missing Intent receiver flags for Tiramisu+ --- app/build.gradle | 32 +++++++++---------- .../szczodrzynski/edziennik/MainActivity.kt | 9 +++++- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b4857ef8..d2c1cb73 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -144,34 +144,32 @@ tasks.whenTaskAdded { task -> } dependencies { - debugImplementation fileTree(include: ['*.jar','*.aar'], dir: 'libs') + implementation fileTree(include: ['*.jar'], dir: 'libs') // Language cores implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "androidx.multidex:multidex:2.0.1" -// implementation files('libs/navlib-debug.aar') -// implementation files('libs/navlib-font-debug.aar') - coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.4" + coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5" // Android Jetpack - implementation "androidx.appcompat:appcompat:1.7.0" + implementation "androidx.appcompat:appcompat:1.5.1" implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.constraintlayout:constraintlayout:2.1.4" - implementation "androidx.core:core-ktx:1.13.1" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.2" - implementation "androidx.navigation:navigation-fragment-ktx:2.7.7" - implementation "androidx.recyclerview:recyclerview:1.3.2" - implementation "androidx.room:room-runtime:2.6.1" - implementation "androidx.work:work-runtime-ktx:2.9.0" - kapt "androidx.room:room-compiler:2.6.1" + implementation "androidx.core:core-ktx:1.9.0" + implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1" + implementation "androidx.navigation:navigation-fragment-ktx:2.5.2" + implementation "androidx.recyclerview:recyclerview:1.2.1" + implementation "androidx.room:room-runtime:2.4.3" + implementation "androidx.work:work-runtime-ktx:2.7.1" + kapt "androidx.room:room-compiler:2.4.3" // Google design libs - implementation "com.google.android.material:material:1.12.0" + implementation "com.google.android.material:material:1.11.0-beta01" implementation "com.google.android.flexbox:flexbox:3.0.0" // Play Services/Firebase - implementation "com.google.android.gms:play-services-wearable:18.2.0" + implementation "com.google.android.gms:play-services-wearable:17.1.0" implementation("com.google.firebase:firebase-core") { version { strictly "19.0.2" } } - implementation "com.google.firebase:firebase-crashlytics:19.0.1" + implementation "com.google.firebase:firebase-crashlytics:18.2.13" implementation("com.google.firebase:firebase-messaging") { version { strictly "20.1.3" } } // OkHttp, Retrofit, Gson, Jsoup @@ -179,7 +177,7 @@ dependencies { implementation "com.squareup.retrofit2:retrofit:2.9.0" implementation "com.squareup.retrofit2:converter-gson:2.9.0" implementation "com.squareup.retrofit2:converter-scalars:2.9.0" - implementation 'com.google.code.gson:gson:2.10.1' + implementation 'com.google.code.gson:gson:2.8.8' implementation 'org.jsoup:jsoup:1.14.3' implementation "pl.droidsonroids:jspoon:1.3.2" implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2" @@ -257,5 +255,5 @@ dependencies { debugImplementation 'net.yslibrary.licenseadapter:licenseadapter:3.0.0' - testImplementation 'junit:junit:4.13.2' + testImplementation 'junit:junit:4.13' } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt index 78a0b709..1ef4bd69 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt @@ -1,5 +1,6 @@ package pl.szczodrzynski.edziennik +import android.annotation.SuppressLint import android.app.ActivityManager import android.content.BroadcastReceiver import android.content.Context @@ -791,7 +792,13 @@ class MainActivity : AppCompatActivity(), CoroutineScope { d(TAG, "Activity resumed") val filter = IntentFilter() filter.addAction(Intent.ACTION_MAIN) - registerReceiver(intentReceiver, filter) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) + registerReceiver(intentReceiver, filter, RECEIVER_NOT_EXPORTED) + else + @Suppress("UnspecifiedRegisterReceiverFlag") + registerReceiver(intentReceiver, filter) + EventBus.getDefault().register(this) super.onResume() }