Skip to content

Commit

Permalink
Merge pull request igniterealtime#641 from Flowdalic/android
Browse files Browse the repository at this point in the history
Android improvements
  • Loading branch information
Flowdalic authored Oct 4, 2024
2 parents c354439 + e1cc1a4 commit e376f55
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
javaVersion = JavaVersion.VERSION_11
javaMajor = javaVersion.getMajorVersion()
smackMinAndroidSdk = 21
smackMinAndroidSdk = 23

androidBootClasspath = { getAndroidRuntimeJar() }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.SystemClock;

/**
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
public class AndroidSmackInitializer implements SmackInitializer {

@Override
// Android deprecated StrictHostnameVerifier in API level 22
@SuppressWarnings("deprecation")
public List<Exception> initialize() {
SmackConfiguration.setDefaultHostnameVerifier(new StrictHostnameVerifier());
Base64.setEncoder(AndroidBase64Encoder.INSTANCE);
Expand Down

0 comments on commit e376f55

Please sign in to comment.