diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8a6579864..fa9bb447a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: uses: android-actions/setup-android@v3 - name: Install Android SDK run: | - sdkmanager "platforms;android-21" + sdkmanager "platforms;android-23" # Testing - name: Gradle Check diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle index 6f92548d3b..94beb432cc 100644 --- a/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle +++ b/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle @@ -3,7 +3,7 @@ plugins { id 'org.igniterealtime.smack.global-conventions' } dependencies { - signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:5.0.1_r2@signature" + signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:6.0_r3@signature" } animalsniffer { sourceSets = [sourceSets.main] diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle index 00fbff9534..5bd92c7eec 100644 --- a/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle +++ b/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle @@ -1,7 +1,7 @@ ext { javaVersion = JavaVersion.VERSION_11 javaMajor = javaVersion.getMajorVersion() - smackMinAndroidSdk = 21 + smackMinAndroidSdk = 23 androidBootClasspath = { getAndroidRuntimeJar() } } diff --git a/smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java b/smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java index f4a93d1507..0315629c8a 100644 --- a/smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java +++ b/smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java @@ -36,6 +36,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.os.Build; import android.os.SystemClock; /** @@ -174,7 +175,11 @@ public static void onCreate(Context context) { sContext = context; context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION)); sAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - sPendingIntent = PendingIntent.getBroadcast(context, 0, new Intent(PING_ALARM_ACTION), 0); + int pendingIntentFlags = 0; + if (Build.VERSION.SDK_INT >= 23) { + pendingIntentFlags |= PendingIntent.FLAG_IMMUTABLE; + } + sPendingIntent = PendingIntent.getBroadcast(context, 0, new Intent(PING_ALARM_ACTION), pendingIntentFlags); sAlarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + AlarmManager.INTERVAL_HALF_HOUR, AlarmManager.INTERVAL_HALF_HOUR, sPendingIntent); diff --git a/smack-android/src/main/java/org/jivesoftware/smack/android/AndroidSmackInitializer.java b/smack-android/src/main/java/org/jivesoftware/smack/android/AndroidSmackInitializer.java index a34fb1776e..b66b564624 100644 --- a/smack-android/src/main/java/org/jivesoftware/smack/android/AndroidSmackInitializer.java +++ b/smack-android/src/main/java/org/jivesoftware/smack/android/AndroidSmackInitializer.java @@ -37,6 +37,8 @@ public class AndroidSmackInitializer implements SmackInitializer { @Override + // Android deprecated StrictHostnameVerifier in API level 22 + @SuppressWarnings("deprecation") public List initialize() { SmackConfiguration.setDefaultHostnameVerifier(new StrictHostnameVerifier()); Base64.setEncoder(AndroidBase64Encoder.INSTANCE);