Skip to content

Commit

Permalink
Bump to Android SDK 33 (#379)
Browse files Browse the repository at this point in the history
* Bump to Android SDK 33

* Add Post_notification permission to Local and PushNotifications
  • Loading branch information
jperedadnr authored Mar 26, 2024
1 parent 16c743a commit f26c5d0
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 22 deletions.
2 changes: 1 addition & 1 deletion gradle/android_project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions gradle/android_project/library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ android {

namespace 'com.gluonhq.helloandroid'

compileSdkVersion 31
compileSdkVersion 33

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
}

compileOptions {
Expand All @@ -22,7 +22,8 @@ android {
implementation 'de.javagl:obj:0.3.0'
}

afterEvaluate {
generateDebugBuildConfig.enabled = false
buildFeatures {
buildConfig = false
resValues = false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ android {

namespace 'com.gluonhq.helloandroid'

compileSdkVersion 31
compileSdkVersion 33

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
}

dependencies {
compileOnly fileTree(dir: '../libs', include: '*.jar')
implementation 'com.google.zxing:core:3.4.1'
}

afterEvaluate {
generateDebugBuildConfig.enabled = false
buildFeatures {
buildConfig = false
resValues = false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
package com.gluonhq.helloandroid;

import android.Manifest;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.Notification;
Expand All @@ -40,6 +41,7 @@
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.util.Log;

public class DalvikLocalNotificationsService {

Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<uses-sdk android:minSdkVersion="21" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application>
<activity android:name='com.gluonhq.helloandroid.MainActivity'
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
package com.gluonhq.helloandroid;

import android.Manifest;
import android.app.Activity;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
Expand All @@ -51,6 +52,13 @@ public class DalvikPushNotificationsService {

public DalvikPushNotificationsService(Activity activity) {
DalvikPushNotificationsService.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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application>
<activity android:name='com.gluonhq.helloandroid.MainActivity'
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ android {

namespace 'com.gluonhq.helloandroid'

compileSdkVersion 31
compileSdkVersion 33

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
}

afterEvaluate {
generateDebugBuildConfig.enabled = false
buildFeatures {
buildConfig = false
resValues = false
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ android {

namespace 'com.gluonhq.helloandroid'

compileSdkVersion 31
compileSdkVersion 33

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
}

afterEvaluate {
generateDebugBuildConfig.enabled = false
buildFeatures {
buildConfig = false
resValues = false
}

}
Expand Down

0 comments on commit f26c5d0

Please sign in to comment.