diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 7f852a1b2..9e338e31f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -21,17 +21,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -42,12 +31,6 @@
-
-
-
-
-
-
@@ -81,11 +64,6 @@
-
serverArray = new LocalPreferences(context).loadServer();
- if (!serverArray.isEmpty()) {
- for (final String serverName : serverArray) {
- final ServerSchema model = httpInventory.setServerModel(serverName);
- inventory.setTag(model.getTag());
- inventory.setAssetItemtype(model.getItemtype());
- inventory.getXML(new InventoryTask.OnTaskCompleted() {
- @Override
- public void onTaskSuccess(String data) {
- ServerSchema model = httpInventory.setServerModel(serverName);
- if(!model.getSerial().trim().isEmpty()) {
- data = data.replaceAll("(.*)","" + model.getSerial() + "");
- }
- httpInventory.sendInventory(data, model, new HttpInventory.OnTaskCompleted() {
- @Override
- public void onTaskSuccess(String data) {
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : Inventory Success");
- Helpers.sendToNotificationBar(context.getApplicationContext(), context.getResources().getString(R.string.inventory_notification_sent));
- //Helpers.sendAnonymousData(context.getApplicationContext(), inventory);
- }
-
- @Override
- public void onTaskError(String error) {
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : Inventory error");
- Helpers.sendToNotificationBar(context.getApplicationContext(), context.getResources().getString(R.string.inventory_notification_fail));
- AgentLog.e(error);
- }
- });
- }
-
- @Override
- public void onTaskError(Throwable error) {
- AgentLog.e(error.getMessage());
- Helpers.sendToNotificationBar(context, context.getResources().getString(R.string.inventory_notification_fail));
- }
- });
- }
- } else {
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : " + context.getResources().getString(R.string.inventory_no_server));
- }
- wl.release();
- }
-
-
- @RequiresApi(api = Build.VERSION_CODES.M)
- public void setAlarm(Context context) {
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : Set Alarm from " + context.getPackageName());
- SharedPreferences customSharedPreference = PreferenceManager.getDefaultSharedPreferences(context);
-
- if(customSharedPreference.getBoolean("autoStartInventory", false)){
- AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
- Intent i = new Intent(context, TimeAlarm.class);
- i.setAction("org.glpi.inventory.agent.ALARM");
- PendingIntent pi = PendingIntent.getBroadcast(context, request_code, i, PendingIntent.FLAG_IMMUTABLE);
-
- String timeInventory = customSharedPreference.getString("timeInventory", "Week");
-
- //int time = 60 * 1000; //minute
- //int time = 30 * 60 * 1000; // 30 minutes
- int time = 60 * 60 * 1000; // 1 hour
-
- if (timeInventory.equals("Day")) {
- //time = 24 * 60 * 60 * 1000;
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : Alarm Daily");
- } else if(timeInventory.equals("Week")) {
- //time = 7 * 24 * 60 * 60 * 1000;
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : Alarm Weekly");
- } else if(timeInventory.equals("Month")) {
- //time = 30 * 24 * 60 * 60 * 1000;
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : Alarm Monthly");
- }
-
- try {
- am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + time, time, pi);
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : Alarm set to " + new Date(System.currentTimeMillis() + time));
- } catch (NullPointerException ex) {
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : " + ex.getMessage());
- AgentLog.e(ex.getMessage());
- }
- } else {
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : autoStartInventory disabled, cancel alarm)");
- cancelAlarm(context);
- }
- }
-
-
- public void cancelAlarm(Context context) {
- Intent intent = new Intent(context, TimeAlarm.class);
- PendingIntent sender = PendingIntent.getBroadcast(context, request_code, intent, PendingIntent.FLAG_IMMUTABLE);
- AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
- alarmManager.cancel(sender);
- }*/
}
diff --git a/app/src/main/java/org/glpi/inventory/agent/core/home/Home.java b/app/src/main/java/org/glpi/inventory/agent/core/home/Home.java
index bf30bead0..81cfbc314 100644
--- a/app/src/main/java/org/glpi/inventory/agent/core/home/Home.java
+++ b/app/src/main/java/org/glpi/inventory/agent/core/home/Home.java
@@ -54,14 +54,12 @@ interface Presenter {
void showError(String message);
// Models
- void doBindService(Activity activity);
void setupList(Activity activity, ListView lst);
void clickItem(final Activity activity, HomeSchema homeSchema);
List getListItems();
}
interface Model {
- void doBindService(Activity activity);
void setupList(Activity activity, ListView lst);
void clickItem(final Activity activity, HomeSchema homeSchema);
List getListItems();
diff --git a/app/src/main/java/org/glpi/inventory/agent/core/home/HomeModel.java b/app/src/main/java/org/glpi/inventory/agent/core/home/HomeModel.java
index 231979643..d6635ce6c 100644
--- a/app/src/main/java/org/glpi/inventory/agent/core/home/HomeModel.java
+++ b/app/src/main/java/org/glpi/inventory/agent/core/home/HomeModel.java
@@ -58,11 +58,6 @@ public HomeModel(Home.Presenter presenter) {
this.presenter = presenter;
}
- public void doBindService(Activity activity) {
-
- }
-
-
@Override
public void setupList(Activity activity, ListView lst) {
arrHome = new ArrayList<>();
diff --git a/app/src/main/java/org/glpi/inventory/agent/core/home/HomePresenter.java b/app/src/main/java/org/glpi/inventory/agent/core/home/HomePresenter.java
index afc2b2d2d..f443a5f76 100644
--- a/app/src/main/java/org/glpi/inventory/agent/core/home/HomePresenter.java
+++ b/app/src/main/java/org/glpi/inventory/agent/core/home/HomePresenter.java
@@ -57,11 +57,6 @@ public void showError(String message) {
}
}
- @Override
- public void doBindService(Activity activity) {
- model.doBindService(activity);
- }
-
@Override
public void setupList(Activity activity, ListView lst) {
model.setupList(activity, lst);
diff --git a/app/src/main/java/org/glpi/inventory/agent/ui/ActivityMain.java b/app/src/main/java/org/glpi/inventory/agent/ui/ActivityMain.java
index b92e7660f..3eb872460 100644
--- a/app/src/main/java/org/glpi/inventory/agent/ui/ActivityMain.java
+++ b/app/src/main/java/org/glpi/inventory/agent/ui/ActivityMain.java
@@ -554,7 +554,7 @@ private JobInfo getJobInfo(final int id, final String timeInventory, final Compo
interval = TimeUnit.DAYS.toMillis(30);
}
- AgentLog.d("GLPI-AGENT-JOBSCHEDULER : Alarm sheduled each " + timeInventory);
+ AgentLog.d("GLPI-AGENT-JOBSCHEDULER : Alarm scheduled each " + timeInventory);
interval = TimeUnit.MINUTES.toMillis(1);
JobInfo.Builder builder = new JobInfo.Builder(id, name)
diff --git a/app/src/main/java/org/glpi/inventory/agent/ui/FragmentHome.java b/app/src/main/java/org/glpi/inventory/agent/ui/FragmentHome.java
index dc2da5c92..8ae5ecba2 100644
--- a/app/src/main/java/org/glpi/inventory/agent/ui/FragmentHome.java
+++ b/app/src/main/java/org/glpi/inventory/agent/ui/FragmentHome.java
@@ -67,8 +67,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
presenter = new HomePresenter(this);
- presenter.doBindService(FragmentHome.this.getActivity());
-
Button btn_run = v.findViewById(R.id.btn_run_inventory);
btn_run.setOnClickListener(new View.OnClickListener() {
@Override