diff --git a/app/build.gradle b/app/build.gradle
index 0417577d..711f8c93 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,12 +1,13 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 30
+ compileSdkVersion 33
+ namespace 'org.emstrack.ambulance'
// buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'org.emstrack.ambulance'
- minSdkVersion 17
- targetSdkVersion 30
+ minSdkVersion 19
+ targetSdkVersion 33
versionCode 10
versionName "0.6.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -25,25 +26,36 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+
+ buildFeatures {
+ buildConfig true
+ }
+
compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
}
productFlavors {
}
+
+ java {
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(17)
+ }
+ }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
- androidTestImplementation 'androidx.test:core:1.2.0'
- androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+ androidTestImplementation 'androidx.test:core:1.6.1'
+ androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- implementation 'com.google.android.gms:play-services-location:17.0.0'
- implementation 'com.google.android.gms:play-services-maps:17.0.0'
+ implementation 'com.google.android.gms:play-services-location:21.3.0'
+ implementation 'com.google.android.gms:play-services-maps:19.2.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
// implementation 'com.google.android.gms:play-services-ads:17.1.3'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
@@ -69,5 +81,5 @@ dependencies {
implementation project(':models')
implementation project(':mqtt')
- testImplementation 'junit:junit:4.12'
+ testImplementation 'junit:junit:4.13.2'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5580eac3..011a819f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,6 +4,7 @@
package="org.emstrack.ambulance">
+
@@ -25,7 +26,8 @@
tools:ignore="GoogleAppIndexingWarning">
+ android:screenOrientation="nosensor"
+ android:exported="true">
diff --git a/app/src/main/java/org/emstrack/ambulance/services/AmbulanceForegroundService.java b/app/src/main/java/org/emstrack/ambulance/services/AmbulanceForegroundService.java
index 4493b690..61f40191 100644
--- a/app/src/main/java/org/emstrack/ambulance/services/AmbulanceForegroundService.java
+++ b/app/src/main/java/org/emstrack/ambulance/services/AmbulanceForegroundService.java
@@ -359,20 +359,20 @@ public int onStartCommand(Intent intent, int flags, int startId) {
Intent notificationIntent = new Intent(AmbulanceForegroundService.this, LoginActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(AmbulanceForegroundService.this, 0,
- notificationIntent, 0);
+ notificationIntent, PendingIntent.FLAG_IMMUTABLE);
// Restart intent
Intent restartServiceIntent = new Intent(AmbulanceForegroundService.this, LoginActivity.class);
restartServiceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
restartServiceIntent.setAction(LoginActivity.LOGOUT);
PendingIntent restartServicePendingIntent = PendingIntent.getActivity(AmbulanceForegroundService.this, 0,
- restartServiceIntent, 0);
+ restartServiceIntent, PendingIntent.FLAG_IMMUTABLE);
// Stop intent
Intent stopServiceIntent = new Intent(AmbulanceForegroundService.this, AmbulanceForegroundService.class);
stopServiceIntent.setAction(Actions.STOP_SERVICE);
PendingIntent stopServicePendingIntent = PendingIntent.getService(AmbulanceForegroundService.this, 0,
- stopServiceIntent, 0);
+ stopServiceIntent, PendingIntent.FLAG_IMMUTABLE);
// Icon
Bitmap icon = BitmapFactory.decodeResource(getResources(),
@@ -1328,7 +1328,7 @@ public void updateNotification(String message) {
LoginActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(AmbulanceForegroundService.this, 0,
- notificationIntent, 0);
+ notificationIntent, PendingIntent.FLAG_IMMUTABLE);
// Stop intent
Intent stopServiceIntent = new Intent(AmbulanceForegroundService.this,
@@ -1336,7 +1336,7 @@ public void updateNotification(String message) {
stopServiceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
stopServiceIntent.setAction(LoginActivity.LOGOUT);
PendingIntent stopServicePendingIntent = PendingIntent.getActivity(AmbulanceForegroundService.this, 0,
- stopServiceIntent, 0);
+ stopServiceIntent, PendingIntent.FLAG_IMMUTABLE);
Notification notification =
new NotificationCompat.Builder(this,
@@ -3047,7 +3047,7 @@ public void subscribeToWebRTC() throws MqttException {
Intent notificationIntent = new Intent(AmbulanceForegroundService.this, LoginActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(AmbulanceForegroundService.this, 0,
- notificationIntent, 0);
+ notificationIntent, PendingIntent.FLAG_IMMUTABLE);
// Create notification
NotificationCompat.Builder mBuilder =
@@ -4382,7 +4382,7 @@ public void processNextCall() {
Intent notificationIntent = new Intent(AmbulanceForegroundService.this, LoginActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(AmbulanceForegroundService.this, 0,
- notificationIntent, 0);
+ notificationIntent, PendingIntent.FLAG_IMMUTABLE);
// Create notification
NotificationCompat.Builder mBuilder =
diff --git a/build.gradle b/build.gradle
index 4dc1795e..6aaff7aa 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,10 +3,10 @@
buildscript {
repositories {
google()
- jcenter()
+ mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.0.0'
+ classpath 'com.android.tools.build:gradle:8.9.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -16,7 +16,7 @@ buildscript {
allprojects {
repositories {
google()
- jcenter()
+ mavenCentral()
}
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 7ef4d54a..34eb83b3 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Jun 01 15:24:31 PDT 2020
+#Tue Apr 29 17:54:58 PDT 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
diff --git a/models/build.gradle b/models/build.gradle
index 3284c262..9cf3c06f 100644
--- a/models/build.gradle
+++ b/models/build.gradle
@@ -1,13 +1,12 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 29
+ compileSdkVersion 33
+ namespace 'org.emstrack.models'
defaultConfig {
- minSdkVersion 17
- targetSdkVersion 29
- versionCode 1
- versionName "1.0"
+ minSdkVersion 19
+ targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -20,8 +19,8 @@ android {
}
}
compileOptions {
- sourceCompatibility = '1.8'
- targetCompatibility = '1.8'
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
}
testOptions {
unitTests {
@@ -33,13 +32,14 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
- testImplementation 'junit:junit:4.12'
- testImplementation 'org.robolectric:robolectric:4.6'
- testImplementation 'androidx.test:core:1.0.0'
-
- androidTestImplementation 'androidx.test:core:1.2.0'
- androidTestImplementation 'androidx.test.ext:junit:1.1.1'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
+ implementation 'androidx.test:rules:1.6.1'
+ testImplementation 'junit:junit:4.13.2'
+ testImplementation 'org.robolectric:robolectric:4.14'
+ testImplementation 'androidx.test:core:1.6.1'
+
+ androidTestImplementation 'androidx.test:core:1.6.1'
+ androidTestImplementation 'androidx.test.ext:junit:1.2.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
api 'com.google.code.gson:gson:2.8.0'
api 'com.squareup.retrofit2:retrofit:2.5.0'
diff --git a/models/src/androidTest/java/org/emstrack/models/ModelInstrumentedTest.java b/models/src/androidTest/java/org/emstrack/models/ModelInstrumentedTest.java
index 9bda3b05..c1ca6764 100644
--- a/models/src/androidTest/java/org/emstrack/models/ModelInstrumentedTest.java
+++ b/models/src/androidTest/java/org/emstrack/models/ModelInstrumentedTest.java
@@ -2,10 +2,11 @@
import android.content.Context;
+import androidx.test.annotation.UiThreadTest;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import android.test.UiThreadTest;
+
import android.util.Log;
import org.emstrack.models.api.APIService;
@@ -47,7 +48,7 @@ public void test_retrofit() throws Exception {
Log.d(TAG, "api");
String username = "admin";
- String password = "cruzrojaadmin";
+ String password = "cruzr0j4";
String serverURI = "https://cruzroja.ucsd.edu/";
Credentials credentials = new Credentials(username, password, serverURI, "");
diff --git a/models/src/main/res/values/strings.xml b/models/src/main/res/values/strings.xml
index a43ea50a..f296495f 100644
--- a/models/src/main/res/values/strings.xml
+++ b/models/src/main/res/values/strings.xml
@@ -1,3 +1,4 @@
models
+ cruzr0j4
diff --git a/models/src/test/java/org/emstrack/models/TestAPI.java b/models/src/test/java/org/emstrack/models/TestAPI.java
index 23537dfe..24df1e4e 100644
--- a/models/src/test/java/org/emstrack/models/TestAPI.java
+++ b/models/src/test/java/org/emstrack/models/TestAPI.java
@@ -42,7 +42,7 @@ public void testApi() throws Exception {
APIService service = APIServiceGenerator.createService(APIService.class);
String username = "admin";
- String password = "cruzrojaadmin";
+ String password = "cruzr0j4";
String serverURI = "https://cruzroja.ucsd.edu/en/";
Credentials credentials = new Credentials(username, password, serverURI, "");
@@ -101,7 +101,7 @@ public void testAsyncApi() throws InterruptedException {
APIService service = APIServiceGenerator.createService(APIService.class);
String username = "admin";
- String password = "cruzrojaadmin";
+ String password = "cruzr0j4";
String serverURI = "https://cruzroja.ucsd.edu/";
Credentials credentials = new Credentials(username, password, serverURI, "");
@@ -132,7 +132,7 @@ public void testAsyncApiCascaded() throws InterruptedException {
APIService service = APIServiceGenerator.createService(APIService.class);
String username = "admin";
- String password = "cruzrojaadmin";
+ String password = "cruzr0j4";
String serverURI = "https://cruzroja.ucsd.edu/";
Credentials credentials = new Credentials(username, password, serverURI, "");
@@ -197,7 +197,7 @@ public void onSuccess(Profile p) {
public void testAsyncApiCascaded2() throws InterruptedException {
String username = "admin";
- String password = "cruzrojaadmin";
+ String password = "cruzr0j4";
String serverURI = "https://cruzroja.ucsd.edu/";
Credentials credentials = new Credentials(username, password, serverURI, "");
diff --git a/models/src/test/java/org/emstrack/models/TestModels.java b/models/src/test/java/org/emstrack/models/TestModels.java
index 210b9b2b..0c7c10cb 100644
--- a/models/src/test/java/org/emstrack/models/TestModels.java
+++ b/models/src/test/java/org/emstrack/models/TestModels.java
@@ -40,6 +40,7 @@ public void test_profile() {
profile.setHospitals(hospitals);
GsonBuilder gsonBuilder = new GsonBuilder();
+ gsonBuilder.setDateFormat("MMM d, y K:mm:ss a");
gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
Gson gson = gsonBuilder.create();
@@ -316,6 +317,7 @@ public void test_settings() {
defaults);
GsonBuilder gsonBuilder = new GsonBuilder();
+ gsonBuilder.setDateFormat("MMM d, y K:mm:ss a");
gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
Gson gson = gsonBuilder.create();
@@ -500,7 +502,7 @@ public void test_ambulance() {
assertEquals(df.format(expectedDate), df.format(answerDate));
// Test partial serialization
- gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
+ gson = new GsonBuilder().setDateFormat("MMM d, y K:mm:ss a").excludeFieldsWithoutExposeAnnotation().create();
to_json = gson.toJson(ambulance);
@@ -804,6 +806,7 @@ public void test_ambulance_call() {
AmbulanceCall ambulanceCall = new AmbulanceCall(1,2,AmbulanceCall.STATUS_SUSPENDED, "", 1, new Date(), waypointSet);
GsonBuilder gsonBuilder = new GsonBuilder();
+ gsonBuilder.setDateFormat("MMM d, y K:mm:ss a");
gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
Gson gson = gsonBuilder.create();
@@ -922,6 +925,7 @@ public void test_call() {
double epsilon = 1e-4;
GsonBuilder gsonBuilder = new GsonBuilder();
+ gsonBuilder.setDateFormat("MMM d, y K:mm:ss a");
gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
Gson gson = gsonBuilder.create();
diff --git a/models/src/test/java/org/emstrack/models/TestOnServiceComplete.java b/models/src/test/java/org/emstrack/models/TestOnServiceComplete.java
index 152b1725..1874f671 100644
--- a/models/src/test/java/org/emstrack/models/TestOnServiceComplete.java
+++ b/models/src/test/java/org/emstrack/models/TestOnServiceComplete.java
@@ -7,6 +7,8 @@
import android.os.Build;
import android.os.Bundle;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+
+import android.os.Looper;
import android.util.Log;
import org.emstrack.models.util.BroadcastActions;
@@ -26,6 +28,7 @@
import static junit.framework.Assert.assertNotNull;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertSame;
+import static org.robolectric.Shadows.shadowOf;
@RunWith(RobolectricTestRunner.class)
@Config(sdk=Build.VERSION_CODES.P)
@@ -73,6 +76,7 @@ public void onReceive(Context context, Intent intent) {
instance.sendBroadcast(new Intent("com.bar"));
assertFalse(called[0]);
instance.sendBroadcast(new Intent("com.foo"));
+ shadowOf(Looper.getMainLooper()).idle();
assertTrue(called[0]);
}
diff --git a/models/src/test/java/org/emstrack/models/TestRetrofit.java b/models/src/test/java/org/emstrack/models/TestRetrofit.java
index 20981152..6cb85e9b 100644
--- a/models/src/test/java/org/emstrack/models/TestRetrofit.java
+++ b/models/src/test/java/org/emstrack/models/TestRetrofit.java
@@ -36,7 +36,7 @@ public void test_retrofit() throws Exception {
System.out.println("servers = " + servers);
String username = "admin";
- String password = "cruzrojaadmin";
+ String password = "cruzr0j4";
String serverURI = "https://cruzroja.ucsd.edu/";
Credentials credentials = new Credentials(username, password, serverURI, "");
@@ -73,7 +73,7 @@ public void test_retrofit_with_credentials() throws Exception {
System.out.println("test_retrofit_with_credentials()");
- Credentials credentials = new Credentials("admin", "cruzrojaadmin",
+ Credentials credentials = new Credentials("admin", "cruzr0j4",
"https://cruzroja.ucsd.edu", "");
// Retrieve token
diff --git a/mqtt/build.gradle b/mqtt/build.gradle
index 43a4ba2e..fd47ebb2 100644
--- a/mqtt/build.gradle
+++ b/mqtt/build.gradle
@@ -1,13 +1,12 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 29
+ compileSdkVersion 33
+ namespace 'org.emstrack.mqtt'
defaultConfig {
- minSdkVersion 17
- targetSdkVersion 29
- versionCode 1
- versionName "1.0"
+ minSdkVersion 19
+ targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -20,15 +19,20 @@ android {
}
}
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test.ext:junit:1.1.1'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
- implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
+ testImplementation 'junit:junit:4.13.2'
+ androidTestImplementation 'androidx.test.ext:junit:1.2.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
+ implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
implementation project(':models')
}
diff --git a/mqtt/src/androidTest/java/org/emstrack/mqtt/MqttInstrumentedTest.java b/mqtt/src/androidTest/java/org/emstrack/mqtt/MqttInstrumentedTest.java
index 815bae26..fd3cab4e 100644
--- a/mqtt/src/androidTest/java/org/emstrack/mqtt/MqttInstrumentedTest.java
+++ b/mqtt/src/androidTest/java/org/emstrack/mqtt/MqttInstrumentedTest.java
@@ -48,7 +48,7 @@ public void testMqttProfileClient() throws Exception {
final String serverUri = "ssl://cruzroja.ucsd.edu:8883";
final String clientId = "TestClient_" + UUID.randomUUID().toString();
final String username = "admin";
- final String password = "cruzrojaadmin";
+ final String password = "cruzr0j4";
MqttAndroidClient client = new MqttAndroidClient(appContext, serverUri, clientId);
final MqttProfileClient profileClient = new MqttProfileClient(client);