diff --git a/IcarusAndroid/app/src/main/java/framework/everywaretechnologies/it/icarusandroid/MainActivity.java b/IcarusAndroid/app/src/main/java/framework/everywaretechnologies/it/icarusandroid/MainActivity.java
index f5248eaa1280056d8588eaabf482d1426874a049..9bf1795999d8bd8cc09962481578ef5f8c274745 100644
--- a/IcarusAndroid/app/src/main/java/framework/everywaretechnologies/it/icarusandroid/MainActivity.java
+++ b/IcarusAndroid/app/src/main/java/framework/everywaretechnologies/it/icarusandroid/MainActivity.java
@@ -8,6 +8,7 @@ import android.view.View;
import android.widget.EditText;
import android.widget.Switch;
+import framework.everywaretechnologies.it.icarus.EventTrackResource;
import framework.everywaretechnologies.it.icarus.Icarus;
import framework.everywaretechnologies.it.icarus.UserSettingsResource;
@@ -27,6 +28,11 @@ public class MainActivity extends AppCompatActivity {
private Switch intPrefSwitch;
private Icarus instance;
+ private EditText eventNameEditText;
+ private EditText eventCategoryEditText;
+ private EditText eventLabelEditText;
+ private EditText mostProbableActivityEditText;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -50,6 +56,11 @@ public class MainActivity extends AppCompatActivity {
if(lastIntPref==1)intPrefSwitch.setChecked(false);
else intPrefSwitch.setChecked(true);
+
+ eventNameEditText=findViewById(R.id.editText_eventName);
+ eventCategoryEditText=findViewById(R.id.editText_eventCategory);
+ eventLabelEditText=findViewById(R.id.editText_eventLabel);
+ mostProbableActivityEditText=findViewById(R.id.editText_mostProbableActivity);
}
//------------------------- UI EVENT -----------------------
@@ -87,4 +98,29 @@ public class MainActivity extends AppCompatActivity {
instance.logUserSettings(userSettingsResource,true);
}
+
+ public void onBtnEventTrack(View view){
+
+ Log.d(CLASS_NAME,"on btn track event");
+
+ String eventName,eventCategory,eventLabel,mostProbableActivity;
+
+ if(eventNameEditText.getText().length() == 0) eventName="eventoProva";
+ else eventName=eventNameEditText.getText().toString();
+
+ if(eventCategoryEditText.getText().length()==0) eventCategory=Icarus.EventCategories.APPLICATION.toString();
+ else eventCategory=eventCategoryEditText.getText().toString();
+
+ if(eventLabelEditText.getText().length()==0) eventLabel = "labelProva";
+ else eventLabel=eventLabelEditText.getText().toString();
+
+ if(mostProbableActivityEditText.getText().length()==0) mostProbableActivity="activityProva";
+ else mostProbableActivity=mostProbableActivityEditText.getText().toString();
+
+ EventTrackResource eventTrackResource=new EventTrackResource(eventName,eventCategory,eventLabel,90,90,5,
+ mostProbableActivity,90,false);
+
+ instance.logEvent(eventTrackResource,true);
+
+ }
}
diff --git a/IcarusAndroid/app/src/main/res/layout/activity_main.xml b/IcarusAndroid/app/src/main/res/layout/activity_main.xml
index 873f17b6841d845281107943329f949b18599e98..4224fa3a485cbc500bd8deb7c455d5c04ecc62bc 100644
--- a/IcarusAndroid/app/src/main/res/layout/activity_main.xml
+++ b/IcarusAndroid/app/src/main/res/layout/activity_main.xml
@@ -74,4 +74,44 @@
android:onClick="onBtnUserPrefChanges"
android:text="Invia pref changes" />
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/IcarusAndroid/icarus/src/main/java/framework/everywaretechnologies/it/icarus/Icarus.java b/IcarusAndroid/icarus/src/main/java/framework/everywaretechnologies/it/icarus/Icarus.java
index e05cc407af522a5576ca3fa685f6c4d891e34766..10ad48e9099ba0eff76253aae80ef2cb3d30b3f1 100644
--- a/IcarusAndroid/icarus/src/main/java/framework/everywaretechnologies/it/icarus/Icarus.java
+++ b/IcarusAndroid/icarus/src/main/java/framework/everywaretechnologies/it/icarus/Icarus.java
@@ -37,7 +37,7 @@ import java.util.function.Consumer;
public class Icarus {
- enum EventCategories{ //categorie di evento
+ public enum EventCategories{ //categorie di evento
APPLICATION,ACTION,NOTIFICATION;
}
@@ -121,8 +121,10 @@ public class Icarus {
public void logEvent(EventTrackResource eventTrackResource, boolean debug){
- Log.d(curContext.getString(R.string.icarus_class),"log event");
+ Log.d(curContext.getString(R.string.icarus_class),"log event -> Volley");
+ JSONObject eventTrackJSON=eventTrackResource.getEventTrackResourceInJSONFormat();
+ postIcarusHttpRequest(eventTrackJSON,debug);
}
diff --git a/IcarusAndroid/icarus/src/main/java/framework/everywaretechnologies/it/icarus/UserSettingsResource.java b/IcarusAndroid/icarus/src/main/java/framework/everywaretechnologies/it/icarus/UserSettingsResource.java
index c87e48ecef30750cea0530a0f27bfd6776a3507d..5746759bb85205ccc81eb488782abb4e9ccba495 100644
--- a/IcarusAndroid/icarus/src/main/java/framework/everywaretechnologies/it/icarus/UserSettingsResource.java
+++ b/IcarusAndroid/icarus/src/main/java/framework/everywaretechnologies/it/icarus/UserSettingsResource.java
@@ -53,7 +53,7 @@ public class UserSettingsResource extends IcarusResource { //classe da non seria
} else { //se è la prima volta che l'utente tocca quella pref
- jsonObject.put("old", null);
+ jsonObject.put("old", null); //TODO: valutare se mettere null come "null" perchè se no nel JSON è come non mettere questo campo, non me lo mette proprio
jsonObject.put("new",newValue);
prefsOldNew.put(prefName,jsonObject.toString());