diff --git a/ebclibrary/build.gradle b/ebclibrary/build.gradle
index 5e18a5b37a1d9a93915bcad19763b5b53abdb3ee..9d5fc0ae64412b96bc322d1cb5bbcbf26fb99935 100644
--- a/ebclibrary/build.gradle
+++ b/ebclibrary/build.gradle
@@ -35,7 +35,7 @@ android {
commandLine './ndk-build-script.sh'
}
//tasks.withType(JavaCompile) {
- //compileTask -> compileTask.dependsOn buildNDK
+ //compileTask -> compileTask.dependsOn buildNDK
//}
buildTypes {
debug {
@@ -54,6 +54,7 @@ dependencies {
// need to put this here or else the class files from ebcutils aren't included in the aar deployed to bintray
//implementation fileTree(include: ['*.jar'], dir: '../ebcutils/build/libs')
implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'com.android.support:support-v4:26.1.0'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
diff --git a/ebclibrary/src/main/AndroidManifest.xml b/ebclibrary/src/main/AndroidManifest.xml
index eaa24bdc4d024eded5e1a8e7666b39acf507bf9e..ba2ea2b9fa2a33ec7279f6b846818530a7c53539 100644
--- a/ebclibrary/src/main/AndroidManifest.xml
+++ b/ebclibrary/src/main/AndroidManifest.xml
@@ -12,25 +12,29 @@
-
+
+
+
-
-
+
+
+
-
-
-
+
-
+ android:writePermission="WRITEPERM" />
+
\ No newline at end of file
diff --git a/ebclibrary/src/main/java/org/mpisws/encounters/EncounterBasedCommunication.java b/ebclibrary/src/main/java/org/mpisws/encounters/EncounterBasedCommunication.java
index 876feae415dae618a0c9a7ec75baab2cec6a3e6f..768f763161344903339c2384aea9fdc05e671213 100644
--- a/ebclibrary/src/main/java/org/mpisws/encounters/EncounterBasedCommunication.java
+++ b/ebclibrary/src/main/java/org/mpisws/encounters/EncounterBasedCommunication.java
@@ -43,7 +43,7 @@ import java.util.List;
*
**/
public class EncounterBasedCommunication {
- public static final long CHANGE_EPOCH_TIME = 2*60000;
+ public static final long CHANGE_EPOCH_TIME = 15*60000;
public static final long SCAN_BATCH_INTERVAL = (long) (2 * 60000);
public static final int REQUEST_ENABLE_BT = 1;
public static final int REQUEST_ACCESS_FINE_LOCATION = 2;
diff --git a/ebclibrary/src/main/java/org/mpisws/encounters/encounterformation/EncounterFormationService.java b/ebclibrary/src/main/java/org/mpisws/encounters/encounterformation/EncounterFormationService.java
index f6286dde0294716ae638703d12598fb16ced3d41..5f20a6b1c3eadb9492e13f812c7e6bec5d03ad70 100644
--- a/ebclibrary/src/main/java/org/mpisws/encounters/encounterformation/EncounterFormationService.java
+++ b/ebclibrary/src/main/java/org/mpisws/encounters/encounterformation/EncounterFormationService.java
@@ -1,6 +1,9 @@
package org.mpisws.encounters.encounterformation;
import android.Manifest;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothManager;
@@ -12,6 +15,13 @@ import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.widget.Toast;
+import org.mpisws.encounters.R;
+import org.mpisws.helpers.ESCredentials;
+import org.mpisws.helpers.GlobalObjectRegistry;
+
+import static android.app.NotificationChannel.DEFAULT_CHANNEL_ID;
+import static android.support.v4.app.NotificationCompat.PRIORITY_LOW;
+
/**
* Created by tslilyai on 10/27/17.
*/
@@ -26,6 +36,7 @@ public class EncounterFormationService extends Service {
private EncounterFormationCore core;
private Thread thread;
public boolean was_destroyed = false;
+ private static final int FOREGROUND_SERVICE_ON = 321;
private void check_and_start_core() {
if (was_destroyed) {
@@ -63,14 +74,30 @@ public class EncounterFormationService extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startID) {
- Log.v(TAG, "Got start command");
+ /*if (GlobalObjectRegistry.getObject(ESCredentials.class) == null ||
+ GlobalObjectRegistry.getObject(ESCredentials.class).getUserHandle() == null) {
+ Intent dialogIntent = new Intent(this, Login.class);
+ dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(dialogIntent);
+ }*/
+
if (intent == null) {
return START_STICKY;
}
- if (intent.getExtras().containsKey("@string.start_sddr_service"))
- {
+ if (intent.getExtras().containsKey("@string.start_sddr_service")) {
check_and_start_core();
+ Intent notificationIntent = new Intent(this, getApplicationContext().getClass());
+ PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
+
+ Notification notification = new Notification.Builder(this, DEFAULT_CHANNEL_ID)
+ .setContentTitle("EbC")
+ .setContentText("Forming encounters")
+ .setSmallIcon(R.drawable.ic_ebc_formation)
+ .setContentIntent(pendingIntent)
+ .setTicker("EbCTicker?")
+ .build();
+ startForeground(FOREGROUND_SERVICE_ON, notification);
return START_STICKY;
}
diff --git a/ebclibrary/src/main/res/drawable-hdpi/ic_action_stat_reply.png b/ebclibrary/src/main/res/drawable-hdpi/ic_action_stat_reply.png
new file mode 100644
index 0000000000000000000000000000000000000000..835d96fc6c3354801c672e6ccfd3661774618b95
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-hdpi/ic_action_stat_reply.png differ
diff --git a/ebclibrary/src/main/res/drawable-hdpi/ic_action_stat_share.png b/ebclibrary/src/main/res/drawable-hdpi/ic_action_stat_share.png
new file mode 100644
index 0000000000000000000000000000000000000000..c329f58daae65d1f35d2959a5c2cac0a0cc7d218
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-hdpi/ic_action_stat_share.png differ
diff --git a/ebclibrary/src/main/res/drawable-hdpi/ic_ebc_formation.png b/ebclibrary/src/main/res/drawable-hdpi/ic_ebc_formation.png
new file mode 100644
index 0000000000000000000000000000000000000000..d2cbb747279ea3b6a96393436082e952e839a88c
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-hdpi/ic_ebc_formation.png differ
diff --git a/ebclibrary/src/main/res/drawable-mdpi/ic_action_stat_reply.png b/ebclibrary/src/main/res/drawable-mdpi/ic_action_stat_reply.png
new file mode 100644
index 0000000000000000000000000000000000000000..9e344659eedcf226ea91afe4846a69827357435d
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-mdpi/ic_action_stat_reply.png differ
diff --git a/ebclibrary/src/main/res/drawable-mdpi/ic_action_stat_share.png b/ebclibrary/src/main/res/drawable-mdpi/ic_action_stat_share.png
new file mode 100644
index 0000000000000000000000000000000000000000..056deb57b92875e9361c4ee2a769023e55aec274
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-mdpi/ic_action_stat_share.png differ
diff --git a/ebclibrary/src/main/res/drawable-mdpi/ic_ebc_formation.png b/ebclibrary/src/main/res/drawable-mdpi/ic_ebc_formation.png
new file mode 100644
index 0000000000000000000000000000000000000000..be0035f5c1001fb2b84f44fa736b32e2eead73d7
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-mdpi/ic_ebc_formation.png differ
diff --git a/ebclibrary/src/main/res/drawable-nodpi/example_picture.png b/ebclibrary/src/main/res/drawable-nodpi/example_picture.png
new file mode 100644
index 0000000000000000000000000000000000000000..e0627f532897da9f078e79c32ae6d7d5792803a4
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-nodpi/example_picture.png differ
diff --git a/ebclibrary/src/main/res/drawable-xhdpi/ic_action_stat_reply.png b/ebclibrary/src/main/res/drawable-xhdpi/ic_action_stat_reply.png
new file mode 100644
index 0000000000000000000000000000000000000000..4cc854ab8001c0bd06aeaafd49467d157a1a9995
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-xhdpi/ic_action_stat_reply.png differ
diff --git a/ebclibrary/src/main/res/drawable-xhdpi/ic_action_stat_share.png b/ebclibrary/src/main/res/drawable-xhdpi/ic_action_stat_share.png
new file mode 100644
index 0000000000000000000000000000000000000000..15549b04eff0aaf80ecd4f5989785bd8bcb1d5fa
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-xhdpi/ic_action_stat_share.png differ
diff --git a/ebclibrary/src/main/res/drawable-xhdpi/ic_ebc_formation.png b/ebclibrary/src/main/res/drawable-xhdpi/ic_ebc_formation.png
new file mode 100644
index 0000000000000000000000000000000000000000..03d62697fdb83472776d96a2931d06639d0b6c79
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-xhdpi/ic_ebc_formation.png differ
diff --git a/ebclibrary/src/main/res/drawable-xxhdpi/ic_ebc_formation.png b/ebclibrary/src/main/res/drawable-xxhdpi/ic_ebc_formation.png
new file mode 100644
index 0000000000000000000000000000000000000000..bcd06f8bd579c02673480137d08f492cab131c56
Binary files /dev/null and b/ebclibrary/src/main/res/drawable-xxhdpi/ic_ebc_formation.png differ
diff --git a/testapp/src/main/java/org/mpisws/testapp/simulator/SimulationClientBT.java b/testapp/src/main/java/org/mpisws/testapp/simulator/SimulationClientBT.java
index b2f198e44dc58e25629ca12d8166573f654536fb..a078c8a355c93bfc2f13338f44b2f3ae53a597fd 100644
--- a/testapp/src/main/java/org/mpisws/testapp/simulator/SimulationClientBT.java
+++ b/testapp/src/main/java/org/mpisws/testapp/simulator/SimulationClientBT.java
@@ -29,7 +29,7 @@ import java.util.UUID;
*/
public class SimulationClientBT {
Context context;
- protected static final int NUM_SIMULATED_DEVICES = 10;
+ protected static final int NUM_SIMULATED_DEVICES = 50;
protected static final int NUM_SIMULATED_EPOCHS = 10;
private static final String TAG = SimulationClientBT.class.getSimpleName();