diff --git a/Examples/OneSignalDemo/app/build.gradle b/Examples/OneSignalDemo/app/build.gradle index f148dcee32..95361f75ca 100644 --- a/Examples/OneSignalDemo/app/build.gradle +++ b/Examples/OneSignalDemo/app/build.gradle @@ -2,10 +2,10 @@ apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' apply plugin: 'com.android.application' android { - compileSdkVersion 30 + compileSdkVersion 31 defaultConfig { minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 1 versionName "1.0" multiDexEnabled true diff --git a/OneSignalSDK/build.gradle b/OneSignalSDK/build.gradle index 024b41090a..8bb3a47424 100644 --- a/OneSignalSDK/build.gradle +++ b/OneSignalSDK/build.gradle @@ -4,8 +4,8 @@ buildscript { ext { buildVersions = [ - compileSdkVersion: 30, - targetSdkVersion: 30 + compileSdkVersion: 31, + targetSdkVersion: 31 ] androidGradlePluginVersion = '3.6.2' googleServicesGradlePluginVersion = '4.3.2' diff --git a/OneSignalSDK/onesignal/src/main/java/com/onesignal/GenerateNotification.java b/OneSignalSDK/onesignal/src/main/java/com/onesignal/GenerateNotification.java index 11aa14f4da..c6cf553551 100644 --- a/OneSignalSDK/onesignal/src/main/java/com/onesignal/GenerateNotification.java +++ b/OneSignalSDK/onesignal/src/main/java/com/onesignal/GenerateNotification.java @@ -767,9 +767,13 @@ private static void createSummaryIdDatabaseEntry(OneSignalDbHelper dbHelper, Str // Keep 'throws Throwable' as 'onesignal_bgimage_notif_layout' may not be available // This maybe the case if a jar is used instead of an aar. private static void addBackgroundImage(JSONObject fcmJson, NotificationCompat.Builder notifBuilder) throws Throwable { - // Required to right align image - if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) + // Not adding Background Images to API Versions < 16 or >= 31 + if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN || + android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + OneSignal.Log(OneSignal.LOG_LEVEL.VERBOSE, + "Cannot use background images in notifications for device on version: " + android.os.Build.VERSION.SDK_INT); return; + } Bitmap bg_image = null; JSONObject jsonBgImage = null;