diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..850c225
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+EasyHarvestClient
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..8d2df47
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/android_maps_utils_0_4.xml b/.idea/libraries/android_maps_utils_0_4.xml
new file mode 100644
index 0000000..6ccf4da
--- /dev/null
+++ b/.idea/libraries/android_maps_utils_0_4.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/appcompat_v7_22_2_0.xml b/.idea/libraries/appcompat_v7_22_2_0.xml
new file mode 100644
index 0000000..a5fde93
--- /dev/null
+++ b/.idea/libraries/appcompat_v7_22_2_0.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/commons_io_2_4.xml b/.idea/libraries/commons_io_2_4.xml
new file mode 100644
index 0000000..ba1046b
--- /dev/null
+++ b/.idea/libraries/commons_io_2_4.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/httpclient_4_2_5.xml b/.idea/libraries/httpclient_4_2_5.xml
new file mode 100644
index 0000000..ddbc48c
--- /dev/null
+++ b/.idea/libraries/httpclient_4_2_5.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/httpcore_4_2_4.xml b/.idea/libraries/httpcore_4_2_4.xml
new file mode 100644
index 0000000..3b0b21e
--- /dev/null
+++ b/.idea/libraries/httpcore_4_2_4.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/mediarouter_v7_22_2_0.xml b/.idea/libraries/mediarouter_v7_22_2_0.xml
new file mode 100644
index 0000000..84adef2
--- /dev/null
+++ b/.idea/libraries/mediarouter_v7_22_2_0.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_7_8_0.xml b/.idea/libraries/play_services_7_8_0.xml
new file mode 100644
index 0000000..bb1a7b1
--- /dev/null
+++ b/.idea/libraries/play_services_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_ads_7_8_0.xml b/.idea/libraries/play_services_ads_7_8_0.xml
new file mode 100644
index 0000000..26d47d3
--- /dev/null
+++ b/.idea/libraries/play_services_ads_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_analytics_7_8_0.xml b/.idea/libraries/play_services_analytics_7_8_0.xml
new file mode 100644
index 0000000..4f4cfe8
--- /dev/null
+++ b/.idea/libraries/play_services_analytics_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_appindexing_7_8_0.xml b/.idea/libraries/play_services_appindexing_7_8_0.xml
new file mode 100644
index 0000000..adea0d0
--- /dev/null
+++ b/.idea/libraries/play_services_appindexing_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_appinvite_7_8_0.xml b/.idea/libraries/play_services_appinvite_7_8_0.xml
new file mode 100644
index 0000000..ae944eb
--- /dev/null
+++ b/.idea/libraries/play_services_appinvite_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_appstate_7_8_0.xml b/.idea/libraries/play_services_appstate_7_8_0.xml
new file mode 100644
index 0000000..2d7db4a
--- /dev/null
+++ b/.idea/libraries/play_services_appstate_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_base_7_8_0.xml b/.idea/libraries/play_services_base_7_8_0.xml
new file mode 100644
index 0000000..cf656b9
--- /dev/null
+++ b/.idea/libraries/play_services_base_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_cast_7_8_0.xml b/.idea/libraries/play_services_cast_7_8_0.xml
new file mode 100644
index 0000000..1d9b7d7
--- /dev/null
+++ b/.idea/libraries/play_services_cast_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_drive_7_8_0.xml b/.idea/libraries/play_services_drive_7_8_0.xml
new file mode 100644
index 0000000..623a825
--- /dev/null
+++ b/.idea/libraries/play_services_drive_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_fitness_7_8_0.xml b/.idea/libraries/play_services_fitness_7_8_0.xml
new file mode 100644
index 0000000..db94fc0
--- /dev/null
+++ b/.idea/libraries/play_services_fitness_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_games_7_8_0.xml b/.idea/libraries/play_services_games_7_8_0.xml
new file mode 100644
index 0000000..931cf9c
--- /dev/null
+++ b/.idea/libraries/play_services_games_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_gcm_7_8_0.xml b/.idea/libraries/play_services_gcm_7_8_0.xml
new file mode 100644
index 0000000..108d107
--- /dev/null
+++ b/.idea/libraries/play_services_gcm_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_identity_7_8_0.xml b/.idea/libraries/play_services_identity_7_8_0.xml
new file mode 100644
index 0000000..6f6e54f
--- /dev/null
+++ b/.idea/libraries/play_services_identity_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_location_7_8_0.xml b/.idea/libraries/play_services_location_7_8_0.xml
new file mode 100644
index 0000000..393b971
--- /dev/null
+++ b/.idea/libraries/play_services_location_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_maps_7_8_0.xml b/.idea/libraries/play_services_maps_7_8_0.xml
new file mode 100644
index 0000000..8c0e03b
--- /dev/null
+++ b/.idea/libraries/play_services_maps_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_nearby_7_8_0.xml b/.idea/libraries/play_services_nearby_7_8_0.xml
new file mode 100644
index 0000000..d1f10b5
--- /dev/null
+++ b/.idea/libraries/play_services_nearby_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_panorama_7_8_0.xml b/.idea/libraries/play_services_panorama_7_8_0.xml
new file mode 100644
index 0000000..0778f52
--- /dev/null
+++ b/.idea/libraries/play_services_panorama_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_plus_7_8_0.xml b/.idea/libraries/play_services_plus_7_8_0.xml
new file mode 100644
index 0000000..0731dbe
--- /dev/null
+++ b/.idea/libraries/play_services_plus_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_safetynet_7_8_0.xml b/.idea/libraries/play_services_safetynet_7_8_0.xml
new file mode 100644
index 0000000..637a600
--- /dev/null
+++ b/.idea/libraries/play_services_safetynet_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_vision_7_8_0.xml b/.idea/libraries/play_services_vision_7_8_0.xml
new file mode 100644
index 0000000..5cfb83b
--- /dev/null
+++ b/.idea/libraries/play_services_vision_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_wallet_7_8_0.xml b/.idea/libraries/play_services_wallet_7_8_0.xml
new file mode 100644
index 0000000..2785146
--- /dev/null
+++ b/.idea/libraries/play_services_wallet_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_wearable_7_8_0.xml b/.idea/libraries/play_services_wearable_7_8_0.xml
new file mode 100644
index 0000000..40469df
--- /dev/null
+++ b/.idea/libraries/play_services_wearable_7_8_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_annotations_23_0_1.xml b/.idea/libraries/support_annotations_23_0_1.xml
new file mode 100644
index 0000000..7259927
--- /dev/null
+++ b/.idea/libraries/support_annotations_23_0_1.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_23_0_1.xml b/.idea/libraries/support_v4_23_0_1.xml
new file mode 100644
index 0000000..a353a01
--- /dev/null
+++ b/.idea/libraries/support_v4_23_0_1.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..7158618
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..b4cef19
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..6564d52
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..7a4fcca
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,2124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1446078239845
+
+ 1446078239845
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EasyHarvestClient.iml b/EasyHarvestClient.iml
new file mode 100644
index 0000000..28fb13a
--- /dev/null
+++ b/EasyHarvestClient.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/app.iml b/app/app.iml
new file mode 100644
index 0000000..361318d
--- /dev/null
+++ b/app/app.iml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..f1a76c5
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,33 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion "23.0.1"
+
+ defaultConfig {
+ applicationId "com.www.client"
+ minSdkVersion 16
+ targetSdkVersion 23
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ debuggable true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ }
+ }
+
+ packagingOptions {
+ exclude 'META-INF/LICENSE.txt'
+ exclude 'META-INF/NOTICE.txt'
+ }
+}
+
+dependencies {
+ compile 'com.android.support:support-v4:+'
+ compile 'com.google.maps.android:android-maps-utils:+'
+ compile 'com.google.android.gms:play-services:+'
+
+ compile fileTree(dir: 'libs', include: '*.jar')
+}
diff --git a/app/libs/commons-io-2.4.jar b/app/libs/commons-io-2.4.jar
new file mode 100644
index 0000000..90035a4
Binary files /dev/null and b/app/libs/commons-io-2.4.jar differ
diff --git a/app/libs/httpclient-4.2.5.jar b/app/libs/httpclient-4.2.5.jar
new file mode 100644
index 0000000..5310588
Binary files /dev/null and b/app/libs/httpclient-4.2.5.jar differ
diff --git a/app/libs/httpcore-4.2.4.jar b/app/libs/httpcore-4.2.4.jar
new file mode 100644
index 0000000..9f45bd9
Binary files /dev/null and b/app/libs/httpcore-4.2.4.jar differ
diff --git a/app/lint.xml b/app/lint.xml
new file mode 100644
index 0000000..ee0eead
--- /dev/null
+++ b/app/lint.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..cac5ea8
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,215 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 0000000..070bb17
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/com/www/client/AppendingObjectOutputStream.java b/app/src/main/java/com/www/client/AppendingObjectOutputStream.java
new file mode 100644
index 0000000..308a7ec
--- /dev/null
+++ b/app/src/main/java/com/www/client/AppendingObjectOutputStream.java
@@ -0,0 +1,18 @@
+package com.www.client;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+
+public class AppendingObjectOutputStream extends ObjectOutputStream {
+
+ public AppendingObjectOutputStream(OutputStream out) throws IOException {
+ super(out);
+ }
+
+ @Override
+ protected void writeStreamHeader() throws IOException {
+ reset();
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/www/client/BootReceiver.java b/app/src/main/java/com/www/client/BootReceiver.java
new file mode 100644
index 0000000..b730646
--- /dev/null
+++ b/app/src/main/java/com/www/client/BootReceiver.java
@@ -0,0 +1,21 @@
+package com.www.client;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+public class BootReceiver extends BroadcastReceiver {
+ private static final String TAG = "BootReceiver";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.i(TAG, "onReceive: " + "...");
+ if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
+ //context.startService(new Intent(context, TaskService.class));
+ context.startService(new Intent(context, TaskService.class));
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/www/client/ClientActivity.java b/app/src/main/java/com/www/client/ClientActivity.java
new file mode 100644
index 0000000..1cb655f
--- /dev/null
+++ b/app/src/main/java/com/www/client/ClientActivity.java
@@ -0,0 +1,329 @@
+package com.www.client;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningServiceInfo;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.graphics.Color;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.Bundle;
+import android.os.Environment;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+import com.www.client.pm.EasyPrivacy;
+import com.www.client.pm.PrivacyMechanism;
+
+import java.io.File;
+import java.io.IOException;
+
+public class ClientActivity extends Activity implements SeekBar.OnSeekBarChangeListener {
+ private static final String SDCARD_DIR = Environment.getExternalStorageDirectory().getPath();
+ public static final String CLIENT_DIR = SDCARD_DIR + "/Client";
+ private static Context context;
+ private static ConnectivityManager connectivityManager;
+ public static boolean restartService = false;
+ SeekBar seekBar;
+ TextView statusText;
+ TextView levelText;
+ TextView commentText;
+ public static SharedPreferences sharedPref = null;
+ public static SharedPreferences.Editor editor = null;
+
+ PrivacyMechanism pm;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ String TAG = getClass().getName() + "@onCreate: ";
+
+ super.onCreate(savedInstanceState);
+
+ Log.wtf(TAG, "...");
+
+ setContentView(R.layout.activity_client);
+ ClientActivity.context = getApplicationContext();
+ connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+ sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
+ editor = sharedPref.edit();
+ seekBar = (SeekBar) findViewById(R.id.levelService);
+ seekBar.setOnSeekBarChangeListener(this);
+ statusText = (TextView) findViewById(R.id.status);
+ levelText = (TextView) findViewById(R.id.level);
+ commentText = (TextView) findViewById(R.id.comment);
+ Button ok = (Button) findViewById(R.id.okButton);
+ Button cancel = (Button) findViewById(R.id.cancelButton);
+ ok.setOnClickListener(okListener);
+ cancel.setOnClickListener(cancelListener);
+ }
+
+ @Override
+ protected void onStart() {
+ String TAG = getClass().getName() + "@onStart: ";
+
+ super.onStart();
+ Log.wtf(TAG, "onStart: " + "...");
+
+ if (sharedPref.getString("username", null) == null) {
+ mkdirs();
+ editor.putInt("serviceLevel", 0);
+ editor.commit();
+ statusText.setTextColor(Color.rgb(255, 0, 0));
+ statusText.setText("OFF");
+ commentText.setTextColor(Color.rgb(100, 100, 100));
+ commentText.setText("Slide the bar right to turn the service on & set the desired level of activity...");
+ } else {
+ seekBar.setProgress(sharedPref.getInt("serviceLevel", 0));
+ seekBar.setSecondaryProgress(sharedPref.getInt("serviceLevel", 0));
+ if (sharedPref.getInt("serviceLevel", 0) > 0) {
+ statusText.setTextColor(Color.rgb(0, 255, 0));
+ statusText.setText("ON");
+ commentText.setTextColor(Color.rgb(255, 255, 255));
+ commentText.setText("The service will download tasks from the server, execute them & send the results back.");
+ if (!isServiceRunning()) {
+ Log.wtf(TAG, "onStart: Restarting...");
+ startService(new Intent(ClientActivity.this, TaskService.class));
+ }
+ } else {
+ statusText.setTextColor(Color.rgb(255, 0, 0));
+ statusText.setText("OFF");
+ commentText.setTextColor(Color.rgb(100, 100, 100));
+ commentText.setText("Nothing to do.");
+ }
+ }
+
+ /*
+ * Do not comment out!
+ */
+ onTest();
+
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ onResume();
+ }
+
+ private void onTest() {
+ String TAG = getClass().getName() + "@onTest: ";
+
+ editor.putString("username", "emkatsom");
+
+// editor.putString("taskID", "1");
+
+ /**/
+// editor.putBoolean(Globals.easy_privacy, false);
+ editor.putBoolean(Globals.easy_privacy, true);
+
+// editor.putString("deviceID", "1234");
+//
+// editor.putString(Globals.pm_id, "13");
+// editor.putInt(Globals.privacy_level, 24);
+ /**/
+
+ editor.commit();
+
+// startActivity(new Intent(getBaseContext(), SettingsActivity.class));
+
+// startActivity(new Intent(getBaseContext(), PrivacyRegionsActivity.class));
+// startActivity(new Intent(getBaseContext(), AddPrivacyRegionActivity.class));
+
+// startActivity(new Intent(getBaseContext(), com.www.client.pm.PrivacyMechanismsActivity.class));
+// startActivity(new Intent(getBaseContext(), com.www.client.pm.ListPrivacyMechanismsActivity.class));
+
+ }
+
+ private OnClickListener okListener = new OnClickListener() {
+ public void onClick(View v) {
+ /**/
+ if (seekBar.getProgress() > 0 && sharedPref.getInt("serviceLevel", 0) == 0) {
+ SharedPreferences.Editor editor = sharedPref.edit();
+ editor.putInt("serviceLevel", seekBar.getProgress());
+ editor.commit();
+ seekBar.setSecondaryProgress(seekBar.getProgress());
+ enableBootReceiver();
+ startService(new Intent(ClientActivity.this, TaskService.class));
+ } else if (seekBar.getProgress() == 0) {
+ SharedPreferences.Editor editor = sharedPref.edit();
+ editor.putInt("serviceLevel", seekBar.getProgress());
+ editor.commit();
+ seekBar.setSecondaryProgress(seekBar.getProgress());
+ disableBootReceiver();
+ stopService(new Intent(ClientActivity.this, TaskService.class));
+ } else {
+ SharedPreferences.Editor editor = sharedPref.edit();
+ editor.putInt("serviceLevel", seekBar.getProgress());
+ editor.commit();
+ seekBar.setSecondaryProgress(seekBar.getProgress());
+ }
+ /**/
+
+ /*
+ if(pm != null) {
+// pm.onStart();
+ } else {
+ pm = new PrivacyMechanism(
+ getApplicationContext(),
+ Integer.valueOf(sharedPref.getString(Globals.pm_id, "0")),
+ Integer.valueOf(sharedPref.getString(Globals.st_id, "0")));
+// pm.onStart();
+ }
+ /**/
+ }
+ };
+
+ private OnClickListener cancelListener = new OnClickListener() {
+ public void onClick(View v) {
+ seekBar.setProgress(sharedPref.getInt("serviceLevel", 0));
+ seekBar.setSecondaryProgress(sharedPref.getInt("serviceLevel", 0));
+ levelText.setText(null);
+
+ /*
+ if(pm != null) {
+ pm.onStop();
+ pm = null;
+ }
+ /**/
+ }
+ };
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.activity_client, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.menu_settings:
+ Intent i = new Intent(this, SettingsActivity.class);
+ startActivity(i);
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+
+ }
+
+ @Override
+ public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {
+ int c = (int) (100 + arg0.getProgress() * 1.55);
+ levelText.setTextColor(Color.rgb(c, c, c));
+ levelText.setText(arg0.getProgress() + "%");
+ if (arg1 == 0) {
+ statusText.setTextColor(Color.rgb(255, 0, 0));
+ statusText.setText("OFF");
+ commentText.setTextColor(Color.rgb(100, 100, 100));
+ commentText.setText("Nothing to do.");
+ } else {
+ statusText.setTextColor(Color.rgb(0, 255, 0));
+ statusText.setText("ON");
+ commentText.setTextColor(Color.rgb(255, 255, 255));
+ commentText.setText("The service will download tasks from the server, execute them & send the results back.");
+ }
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar arg0) {
+ int c = (int) (100 + arg0.getProgress() * 1.55);
+ levelText.setTextColor(Color.rgb(c, c, c));
+ levelText.setText(arg0.getProgress() + "%");
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar arg0) {
+ levelText.setText(null);
+ }
+
+ private void enableBootReceiver() {
+ ComponentName receiver = new ComponentName(context, BootReceiver.class);
+ PackageManager pm = context.getPackageManager();
+ pm.setComponentEnabledSetting(receiver,
+ PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+ PackageManager.DONT_KILL_APP);
+ }
+
+ private void disableBootReceiver() {
+ ComponentName receiver = new ComponentName(context, BootReceiver.class);
+ PackageManager pm = context.getPackageManager();
+ pm.setComponentEnabledSetting(receiver,
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
+ }
+
+ public static Context getContext() {
+ return ClientActivity.context;
+ }
+
+ public static boolean isOnline() {
+ Boolean wifiConnected, mobileConnected;
+ NetworkInfo activeInfo = connectivityManager.getActiveNetworkInfo();
+ if (activeInfo != null && activeInfo.isConnected()) {
+ wifiConnected = activeInfo.getType() == ConnectivityManager.TYPE_WIFI;
+ mobileConnected = activeInfo.getType() == ConnectivityManager.TYPE_MOBILE;
+ } else {
+ wifiConnected = false;
+ mobileConnected = false;
+ }
+ if (((ClientActivity.sharedPref.getString("listPref", "Wi-Fi").equals("Any")) && (wifiConnected || mobileConnected))
+ || ((ClientActivity.sharedPref.getString("listPref", "Wi-Fi").equals("Wi-Fi")) && (wifiConnected))) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private boolean isServiceRunning() {
+ ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
+ for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
+ if (TaskService.class.getName().equals(service.service.getClassName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void mkdirs() {
+ String TAG = getClass().getName() + "@mkdirs: ";
+
+ File clientDir = new File(CLIENT_DIR);
+ File settingsDir = new File(CLIENT_DIR + "/Settings");
+ File pmsDir = new File(CLIENT_DIR + "/PMs");
+
+ Utils.delete(clientDir);
+ Utils.delete(settingsDir);
+ Utils.delete(pmsDir);
+
+ if(clientDir.mkdir()) {
+ Log.wtf(TAG, "Created " + clientDir.getPath());
+ } else {
+ Log.wtf(TAG, "Could not create Client directory.");
+ }
+
+ if(settingsDir.mkdir()) {
+ Log.wtf(TAG, "Created " + settingsDir.getPath());
+ } else {
+ Log.wtf(TAG, "Could not create Settings directory.");
+ }
+
+ if(pmsDir.mkdir()) {
+ Log.wtf(TAG, "Created " + pmsDir.getPath());
+ } else {
+ Log.wtf(TAG, "Could not create PMs directory.");
+ }
+ }
+}
diff --git a/app/src/main/java/com/www/client/Globals.java b/app/src/main/java/com/www/client/Globals.java
new file mode 100644
index 0000000..ed394e8
--- /dev/null
+++ b/app/src/main/java/com/www/client/Globals.java
@@ -0,0 +1,82 @@
+package com.www.client;
+
+import android.os.Environment;
+
+public class Globals {
+ /**
+ * Evaluation
+ */
+// public static boolean eval_status = true;
+ public static boolean eval_status = false;
+
+ // Beauty
+// public static String eval_dev = "MID7188";
+// public static String eval_ip = "192.168.49.1";
+
+ // Nexus
+// public static String eval_dev = "occam";
+// public static String eval_ip = "192.168.49.75";
+
+ /**
+ * Description: device URLS.
+ * Changelog : - .
+ */
+ public static String sdcard_dir = Environment.getExternalStorageDirectory().getPath();
+ public static String client_dir = sdcard_dir + "/Client";
+ public static String pms_dir = client_dir + "/PMs";
+
+ /**
+ * Description: URLS.
+ * Changelog : - .
+ */
+ public static String server_url = "http://83.212.109.118:8080/Server/webresources";
+// public static String server_url = "http://192.168.2.2:8084/Server/webresources";
+// public static String server_url = "http://10.64.83.194:8084/Server/webresources";
+
+ public static String devs_url = server_url + "/devs";
+ public static String tasks_url = server_url + "/tasks";
+
+ public static String pms_url = server_url + "/pms";
+ public static int pm_port = 4545;
+
+ /**
+ * Description: Time latency in ms.
+ * Changelog : - .
+ */
+ public static int task_latency = 10 * 100 * 1000;
+ public static int pm_latency = 1 * 100 * 1000;
+
+ /**
+ * Description: EasyHarvest client shared preferences labels.
+ * Changelog : - .
+ */
+ public static String shr_user = "username"; // string
+ public static String shr_dev_id = "deviceID"; // string
+
+ /**
+ * Description: Sensing tasks shared preferences labels.
+ * Changelog : - .
+ */
+ public static String st_id = "taskID"; // string
+
+
+ /**
+ * Description: Privacy mechanisms shared preferences labels.
+ * Changelog : - .
+ */
+ public static String easy_privacy = "EasyPrivacy"; // boolean
+
+ public static String privacy_level = "privacyLevel"; // integer
+
+ public static String pm_name = "pmName"; // string
+ public static String pm_clss = "pmClss"; //
+ public static String pm_id = "pmID"; //
+ public static String pm_vers = "pmVersion"; //
+ public static String pm_st_id = "pmTaskId"; //
+ public static String pm_user = "pmUser"; //
+ public static String pm_desc = "pmDescription"; //
+ public static String pm_date = "pmDate"; //
+ public static String pm_time = "pmTime"; //
+ public static String pm_size = "pmSize"; //
+
+}
diff --git a/app/src/main/java/com/www/client/Item.java b/app/src/main/java/com/www/client/Item.java
new file mode 100644
index 0000000..848c25e
--- /dev/null
+++ b/app/src/main/java/com/www/client/Item.java
@@ -0,0 +1,36 @@
+package com.www.client;
+
+public class Item {
+ String text = "";
+ int image = 0;
+
+ public Item(String text, int image) {
+ this.text = text;
+ this.image = image;
+ }
+
+ public Item(String text) {
+ this.text = text;
+ }
+
+ public int getImage() {
+ return image;
+ }
+
+ public void setImage(int image) {
+ this.image = image;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ @Override
+ public String toString() {
+ return text;
+ }
+}
diff --git a/app/src/main/java/com/www/client/ItemArrayAdapter.java b/app/src/main/java/com/www/client/ItemArrayAdapter.java
new file mode 100644
index 0000000..72188a1
--- /dev/null
+++ b/app/src/main/java/com/www/client/ItemArrayAdapter.java
@@ -0,0 +1,56 @@
+package com.www.client;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.List;
+
+public class ItemArrayAdapter extends ArrayAdapter {
+
+ private static final String TAG = "ItemArrayAdapter";
+ Context context;
+
+ public ItemArrayAdapter(Context context, int resourceId, List items) {
+ super(context, resourceId, items);
+ this.context = context;
+ }
+
+ /*private view holder class*/
+ private class ViewHolder {
+ TextView textView;
+ ImageView imageView;
+ }
+
+ public View getView(int position, View view, ViewGroup group) {
+ ViewHolder holder = null;
+ JSONObject item = getItem(position);
+
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
+ if (view == null) {
+ view = inflater.inflate(R.layout.item, null);
+ holder = new ViewHolder();
+ holder.textView = (TextView) view.findViewById(R.id.text);
+ view.setTag(holder);
+ }
+ else {
+ holder = (ViewHolder) view.getTag();
+ }
+
+ try {
+ holder.textView.setText(item.getString("label"));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return view;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/www/client/SettingsActivity.java b/app/src/main/java/com/www/client/SettingsActivity.java
new file mode 100644
index 0000000..6992c7d
--- /dev/null
+++ b/app/src/main/java/com/www/client/SettingsActivity.java
@@ -0,0 +1,244 @@
+package com.www.client;
+
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningServiceInfo;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceManager;
+import android.preference.PreferenceScreen;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.www.client.pm.PrivacyMechanismsActivity;
+import com.www.client.pr.PrivacyRegionsActivity;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import java.io.File;
+import java.io.IOException;
+
+public class SettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener, OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
+ private static final String TAG = "SettingsActivity";
+
+ public static PreferenceScreen prefScreen = null;
+ public static SharedPreferences sp = null;
+ public static SharedPreferences.Editor spEditor = null;
+
+ SwitchPref privacyRegions = null;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ //Log.wtf(TAG, "onCreate");
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.preferences);
+
+ /*
+ * Privacy regions switch listener.
+ */
+ privacyRegions = (SwitchPref) findPreference(getResources().getString((R.string.privacy_regions_status)));
+ privacyRegions.setOnPreferenceClickListener(this);
+ privacyRegions.setOnPreferenceChangeListener(this);
+
+ /*
+ * Set preference item listeners.
+ */
+ findPreference(getResources().getString((R.string.privacy_mechanisms_key))).setOnPreferenceClickListener(this);
+
+ findPreference("device_unregister").setOnPreferenceClickListener(this);
+
+ }
+
+ @Override
+ protected void onResume() {
+ //Log.wtf(TAG, "onResume");
+ super.onResume();
+ if (sp == null) {
+ //Log.wtf(TAG, "onResume: " + "sp == null");
+ sp = PreferenceManager.getDefaultSharedPreferences(this);
+ spEditor = sp.edit();
+ sp.registerOnSharedPreferenceChangeListener(this);
+ } else {
+ //Log.wtf(TAG, "onResume: " + "sp != null");
+ }
+ privacyRegions.setChecked(sp.getBoolean(getResources().getString((R.string.privacy_regions_status)), false));
+ //this.onContentChanged();
+ }
+
+ @Override
+ protected void onPause() {
+ //Log.wtf(TAG, "onPause");
+ super.onPause();
+ if (sp != null) {
+ sp.unregisterOnSharedPreferenceChangeListener(this);
+ sp = null;
+ }
+ }/**/
+
+ @Override
+ protected void onStop() {
+ //Log.wtf(TAG, "onStop");
+ super.onStop();
+ if (sp != null) {
+ sp.unregisterOnSharedPreferenceChangeListener(this);
+ sp = null;
+ }
+ //finish();
+ }/**/
+
+ /*@Override
+ protected void onDestroy() {
+ Log.wtf(TAG, "onDestroy");
+ super.onDestroy();
+ sp.unregisterOnSharedPreferenceChangeListener(this);
+ sp = null;
+ }/**/
+
+ /*@Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ Log.wtf(TAG, "onConfigurationChanged");
+ super.onConfigurationChanged(newConfig);
+ //onResume();
+ }*/
+
+
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+// Toast.makeText(getApplicationContext(), "onSharedPreferenceChanged: " + key, Toast.LENGTH_SHORT).show();
+ Log.wtf(TAG, "onSharedPreferenceChanged: " + sharedPreferences.getAll());
+ if (key.equals("listPref") || key.equals(getResources().getString((R.string.privacy_regions_status)))) {
+// ClientActivity.restartService = true;
+ Toast.makeText(getApplicationContext(), "Restarting...", Toast.LENGTH_SHORT).show();
+ if (isServiceRunning()) {
+ Log.wtf(TAG, "onSharedPreferenceChanged: " + "Restarting service...");
+ stopService(new Intent(this, TaskService.class));
+ startService(new Intent(this, TaskService.class));
+ }
+ }
+ }
+
+ /*
+ * Control action when a preference is clicked.
+ */
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+// Toast.makeText(getApplicationContext(), "onPreferenceClick: " + preference.getKey(), Toast.LENGTH_SHORT).show();
+
+ /*
+ * Launch Privacy Regions activity.
+ */
+ if (getResources().getString((R.string.privacy_regions_status)).equals(preference.getKey())) {
+// Toast.makeText(ClientActivity.getContext(), "onPreferenceClick: " + preference.getKey(), Toast.LENGTH_SHORT).show();
+ Intent i = new Intent(this, PrivacyRegionsActivity.class);
+ startActivity(i);
+ }
+
+ /*
+ * Launch Privacy Mechanisms activity.
+ */
+ if (getResources().getString((R.string.privacy_mechanisms_key)).equals(preference.getKey())) {
+// Toast.makeText(ClientActivity.getContext(), "onPreferenceClick: " + preference.getKey(), Toast.LENGTH_SHORT).show();
+ Intent i = new Intent(this, PrivacyMechanismsActivity.class);
+ startActivity(i);
+ }
+
+ /*
+ * Unregister the device.
+ */
+ if ("device_unregister".equals(preference.getKey())) {
+ Toast.makeText(ClientActivity.getContext(), "Unregistering...", Toast.LENGTH_SHORT).show();
+ String deviceID = ClientActivity.sharedPref.getString("deviceID", null);
+ if (deviceID != null) {
+ if (ClientActivity.isOnline()) {
+ Log.wtf(TAG, "deviceUnregister: " + "Online.");
+ String url = Globals.devs_url + "/" + deviceID + "/unregister";
+ Log.wtf(TAG, "deviceUnregister: " + "" + deviceID + "/unregister");
+ new DeviceUnregister().execute(url);
+ } else {
+ Log.wtf(TAG, "deviceUnregister: " + "Offline.");
+ Toast.makeText(ClientActivity.getContext(), "No internet connection", Toast.LENGTH_SHORT).show();
+ }
+ } else {
+ Toast.makeText(ClientActivity.getContext(), "Not registered", Toast.LENGTH_SHORT).show();
+ }
+
+ }
+ return false;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object o) {
+ //Toast.makeText(getApplicationContext(), "onPreferenceChange: " + preference.getKey(), Toast.LENGTH_SHORT).show();
+ if ("privacyRegionsStatus".equals(preference.getKey())) {
+ //Toast.makeText(getApplicationContext(), "onPreferenceChange: " + preference.getKey() + " = " + o.toString(), Toast.LENGTH_SHORT).show();
+ }
+ return true;
+ }
+
+ private class DeviceUnregister extends AsyncTask {
+ private static final String TAG = "DeviceUnregister";
+ private HttpClient client;
+
+ @Override
+ protected String doInBackground(String... urls) {
+ Log.wtf(TAG, "doInBackground: " + "...");
+ client = new DefaultHttpClient();
+ HttpGet request = new HttpGet(urls[0]);
+ HttpResponse response = null;
+ String result = "oops";
+ try {
+ response = client.execute(request);
+ } catch (Exception e) {
+ //e.printStackTrace();
+ }
+ if (response != null) {
+ try {
+ result = Utils.writeToString(response.getEntity().getContent());
+ } catch (Exception e) {
+ }
+ }
+ return result;
+ }
+
+ protected void onPostExecute(String result) {
+ Log.wtf(TAG, "onPostExecute: " + result + ".");
+ if (result.equals("OK") || result.equals("Not registered")) {
+ Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
+ stopService(new Intent(getApplicationContext(), TaskService.class));
+ spEditor.putInt("serviceLevel", 0);
+ spEditor.putString("deviceID", null);
+ spEditor.putString("username", null);
+ spEditor.putString("serviceStatus", "get");
+ spEditor.putString("getStatus", "getTaskInfo");
+ spEditor.commit();
+ try {
+ FileUtils.cleanDirectory(new File(ClientActivity.CLIENT_DIR));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } else {
+ Toast.makeText(getApplicationContext(), "Oops!", Toast.LENGTH_SHORT).show();
+ }
+ }
+ }
+
+ private boolean isServiceRunning() {
+ ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
+ for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
+ if (TaskService.class.getName().equals(service.service.getClassName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/app/src/main/java/com/www/client/SwitchPref.java b/app/src/main/java/com/www/client/SwitchPref.java
new file mode 100644
index 0000000..9adc08f
--- /dev/null
+++ b/app/src/main/java/com/www/client/SwitchPref.java
@@ -0,0 +1,25 @@
+package com.www.client;
+
+import android.content.Context;
+import android.preference.SwitchPreference;
+import android.util.AttributeSet;
+
+public class SwitchPref extends SwitchPreference {
+
+ public SwitchPref(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ public SwitchPref(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public SwitchPref(Context context) {
+ super(context);
+ }
+
+ @Override
+ protected void onClick() {
+ //super.onClick();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/www/client/TaskService.java b/app/src/main/java/com/www/client/TaskService.java
new file mode 100644
index 0000000..591d5a7
--- /dev/null
+++ b/app/src/main/java/com/www/client/TaskService.java
@@ -0,0 +1,2254 @@
+package com.www.client;
+
+import android.app.*;
+import android.content.*;
+import android.location.*;
+import android.net.*;
+import android.os.*;
+import android.preference.*;
+import android.util.*;
+import android.widget.*;
+
+import com.www.client.pm.PrivacyMechanism;
+
+import org.apache.http.*;
+import org.apache.http.client.*;
+import org.apache.http.client.entity.*;
+import org.apache.http.client.methods.*;
+import org.apache.http.impl.client.*;
+import org.apache.http.message.*;
+import org.json.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.util.*;
+import java.util.regex.*;
+
+import dalvik.system.DexClassLoader;
+
+
+public class TaskService extends Service implements LocationListener {
+
+ private static Context context;
+
+ private static final int API = android.os.Build.VERSION.SDK_INT;
+ public static final String WIFI = "Wi-Fi";
+ public static final String ANY = "Any";
+
+ private static final String SDCARD = Environment.getExternalStorageDirectory().getPath();
+ public static final String CLIENT = SDCARD + "/Client";
+
+ private static Class