mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 03:52:06 +01:00
commit
e376f55ea9
5 changed files with 11 additions and 4 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -56,7 +56,7 @@ jobs:
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
- name: Install Android SDK
|
- name: Install Android SDK
|
||||||
run: |
|
run: |
|
||||||
sdkmanager "platforms;android-21"
|
sdkmanager "platforms;android-23"
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
- name: Gradle Check
|
- name: Gradle Check
|
||||||
|
|
|
@ -3,7 +3,7 @@ plugins {
|
||||||
id 'org.igniterealtime.smack.global-conventions'
|
id 'org.igniterealtime.smack.global-conventions'
|
||||||
}
|
}
|
||||||
dependencies {
|
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 {
|
animalsniffer {
|
||||||
sourceSets = [sourceSets.main]
|
sourceSets = [sourceSets.main]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
javaVersion = JavaVersion.VERSION_11
|
javaVersion = JavaVersion.VERSION_11
|
||||||
javaMajor = javaVersion.getMajorVersion()
|
javaMajor = javaVersion.getMajorVersion()
|
||||||
smackMinAndroidSdk = 21
|
smackMinAndroidSdk = 23
|
||||||
|
|
||||||
androidBootClasspath = { getAndroidRuntimeJar() }
|
androidBootClasspath = { getAndroidRuntimeJar() }
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,7 +175,11 @@ public final class ServerPingWithAlarmManager extends Manager {
|
||||||
sContext = context;
|
sContext = context;
|
||||||
context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION));
|
context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION));
|
||||||
sAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
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,
|
sAlarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
|
||||||
SystemClock.elapsedRealtime() + AlarmManager.INTERVAL_HALF_HOUR,
|
SystemClock.elapsedRealtime() + AlarmManager.INTERVAL_HALF_HOUR,
|
||||||
AlarmManager.INTERVAL_HALF_HOUR, sPendingIntent);
|
AlarmManager.INTERVAL_HALF_HOUR, sPendingIntent);
|
||||||
|
|
|
@ -37,6 +37,8 @@ import org.minidns.dnsserverlookup.android21.AndroidUsingLinkProperties;
|
||||||
public class AndroidSmackInitializer implements SmackInitializer {
|
public class AndroidSmackInitializer implements SmackInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
// Android deprecated StrictHostnameVerifier in API level 22
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public List<Exception> initialize() {
|
public List<Exception> initialize() {
|
||||||
SmackConfiguration.setDefaultHostnameVerifier(new StrictHostnameVerifier());
|
SmackConfiguration.setDefaultHostnameVerifier(new StrictHostnameVerifier());
|
||||||
Base64.setEncoder(AndroidBase64Encoder.INSTANCE);
|
Base64.setEncoder(AndroidBase64Encoder.INSTANCE);
|
||||||
|
|
Loading…
Reference in a new issue