From f26c5d0f3143df54493c7ad7c8f85bab4291ab50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pereda?= Date: Tue, 26 Mar 2024 09:57:52 +0100 Subject: [PATCH] Bump to Android SDK 33 (#379) * Bump to Android SDK 33 * Add Post_notification permission to Local and PushNotifications --- gradle/android_project/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- gradle/android_project/library/build.gradle | 9 +++++---- .../resources/META-INF/substrate/dalvik/build.gradle | 9 +++++---- .../resources/META-INF/substrate/dalvik/build.gradle | 9 +++++---- .../android/dalvik/DalvikLocalNotificationsService.java | 9 +++++++++ .../META-INF/substrate/dalvik/AndroidManifest.xml | 1 + .../android/dalvik/DalvikPushNotificationsService.java | 8 ++++++++ .../META-INF/substrate/dalvik/AndroidManifest.xml | 1 + .../resources/META-INF/substrate/dalvik/build.gradle | 9 +++++---- .../resources/META-INF/substrate/dalvik/build.gradle | 9 +++++---- 11 files changed, 46 insertions(+), 22 deletions(-) diff --git a/gradle/android_project/build.gradle b/gradle/android_project/build.gradle index c98ce29c..2e993cfa 100644 --- a/gradle/android_project/build.gradle +++ b/gradle/android_project/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.0' + classpath 'com.android.tools.build:gradle:8.1.1' } } diff --git a/gradle/android_project/gradle/wrapper/gradle-wrapper.properties b/gradle/android_project/gradle/wrapper/gradle-wrapper.properties index 0e9a6105..7666e22b 100644 --- a/gradle/android_project/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/android_project/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip diff --git a/gradle/android_project/library/build.gradle b/gradle/android_project/library/build.gradle index 855ed95e..3ad670d1 100644 --- a/gradle/android_project/library/build.gradle +++ b/gradle/android_project/library/build.gradle @@ -4,18 +4,19 @@ android { namespace 'com.gluonhq.helloandroid' - compileSdkVersion 31 + compileSdkVersion 33 defaultConfig { minSdkVersion 21 - targetSdkVersion 31 + targetSdkVersion 33 } dependencies { compileOnly fileTree(dir: '../libs', include: '*.jar') } - afterEvaluate { - generateDebugBuildConfig.enabled = false + buildFeatures { + buildConfig = false + resValues = false } } diff --git a/modules/augmented-reality/src/main/resources/META-INF/substrate/dalvik/build.gradle b/modules/augmented-reality/src/main/resources/META-INF/substrate/dalvik/build.gradle index 84030b34..68ddd402 100644 --- a/modules/augmented-reality/src/main/resources/META-INF/substrate/dalvik/build.gradle +++ b/modules/augmented-reality/src/main/resources/META-INF/substrate/dalvik/build.gradle @@ -4,11 +4,11 @@ android { namespace 'com.gluonhq.helloandroid' - compileSdkVersion 31 + compileSdkVersion 33 defaultConfig { minSdkVersion 21 - targetSdkVersion 31 + targetSdkVersion 33 } compileOptions { @@ -22,7 +22,8 @@ android { implementation 'de.javagl:obj:0.3.0' } - afterEvaluate { - generateDebugBuildConfig.enabled = false + buildFeatures { + buildConfig = false + resValues = false } } diff --git a/modules/barcode-scan/src/main/resources/META-INF/substrate/dalvik/build.gradle b/modules/barcode-scan/src/main/resources/META-INF/substrate/dalvik/build.gradle index c5e8fabb..287faddd 100644 --- a/modules/barcode-scan/src/main/resources/META-INF/substrate/dalvik/build.gradle +++ b/modules/barcode-scan/src/main/resources/META-INF/substrate/dalvik/build.gradle @@ -4,11 +4,11 @@ android { namespace 'com.gluonhq.helloandroid' - compileSdkVersion 31 + compileSdkVersion 33 defaultConfig { minSdkVersion 21 - targetSdkVersion 31 + targetSdkVersion 33 } dependencies { @@ -16,7 +16,8 @@ android { implementation 'com.google.zxing:core:3.4.1' } - afterEvaluate { - generateDebugBuildConfig.enabled = false + buildFeatures { + buildConfig = false + resValues = false } } diff --git a/modules/local-notifications/src/main/native/android/dalvik/DalvikLocalNotificationsService.java b/modules/local-notifications/src/main/native/android/dalvik/DalvikLocalNotificationsService.java index 2bcd7604..0ba819ea 100644 --- a/modules/local-notifications/src/main/native/android/dalvik/DalvikLocalNotificationsService.java +++ b/modules/local-notifications/src/main/native/android/dalvik/DalvikLocalNotificationsService.java @@ -27,6 +27,7 @@ */ package com.gluonhq.helloandroid; +import android.Manifest; import android.app.Activity; import android.app.AlarmManager; import android.app.Notification; @@ -40,6 +41,7 @@ import android.graphics.Color; import android.net.Uri; import android.os.Build; +import android.util.Log; public class DalvikLocalNotificationsService { @@ -50,6 +52,13 @@ public class DalvikLocalNotificationsService { public DalvikLocalNotificationsService(Activity activity) { DalvikLocalNotificationsService.this.activity = activity; + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + boolean notificationsEnabled = Util.verifyPermissions(Manifest.permission.POST_NOTIFICATIONS); + if (!notificationsEnabled) { + Log.v(TAG, "Post notifications disabled. POST_NOTIFICATIONS permission is required"); + } + } } static Activity getActivity() { diff --git a/modules/local-notifications/src/main/resources/META-INF/substrate/dalvik/AndroidManifest.xml b/modules/local-notifications/src/main/resources/META-INF/substrate/dalvik/AndroidManifest.xml index e072516d..dbf827af 100644 --- a/modules/local-notifications/src/main/resources/META-INF/substrate/dalvik/AndroidManifest.xml +++ b/modules/local-notifications/src/main/resources/META-INF/substrate/dalvik/AndroidManifest.xml @@ -2,6 +2,7 @@ + = Build.VERSION_CODES.TIRAMISU) { + boolean notificationsEnabled = Util.verifyPermissions(Manifest.permission.POST_NOTIFICATIONS); + if (!notificationsEnabled) { + Log.v(TAG, "Post notifications disabled. POST_NOTIFICATIONS permission is required"); + } + } } static Activity getActivity() { diff --git a/modules/push-notifications/src/main/resources/META-INF/substrate/dalvik/AndroidManifest.xml b/modules/push-notifications/src/main/resources/META-INF/substrate/dalvik/AndroidManifest.xml index 605c8028..d203652b 100644 --- a/modules/push-notifications/src/main/resources/META-INF/substrate/dalvik/AndroidManifest.xml +++ b/modules/push-notifications/src/main/resources/META-INF/substrate/dalvik/AndroidManifest.xml @@ -4,6 +4,7 @@ +