diff --git a/example_kotlin/src/main/java/org/flyve/example_kotlin/MainActivity.kt b/example_kotlin/src/main/java/org/flyve/example_kotlin/MainActivity.kt index 2c8df4d36..fe817a0d6 100644 --- a/example_kotlin/src/main/java/org/flyve/example_kotlin/MainActivity.kt +++ b/example_kotlin/src/main/java/org/flyve/example_kotlin/MainActivity.kt @@ -13,7 +13,8 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - val inventoryTask = InventoryTask(this@MainActivity, "example-app-kotlin") + InventoryTask.showFILog = true + val inventoryTask = InventoryTask(this@MainActivity, "example-app-kotlin", false) inventoryTask.getJSON( object : InventoryTask.OnTaskCompleted { override fun onTaskSuccess(data: String) { Log.d(LOG, data) diff --git a/inventory/src/main/java/org/flyve/inventory/InventoryTask.java b/inventory/src/main/java/org/flyve/inventory/InventoryTask.java index 40ae0d14a..2e74adbf8 100644 --- a/inventory/src/main/java/org/flyve/inventory/InventoryTask.java +++ b/inventory/src/main/java/org/flyve/inventory/InventoryTask.java @@ -52,6 +52,10 @@ */ public class InventoryTask { + /** + * Set if show FILog in console + */ + public static boolean showFILog = false; private static Handler uiHandler; private Boolean running = false; @@ -81,14 +85,15 @@ public Boolean isRunning() { * @param context The context to be use * @param appVersion The name of the agent */ - public InventoryTask(Context context, String appVersion) { + public InventoryTask(Context context, String appVersion, Boolean storeResult) { + this(storeResult); this.appVersion = appVersion; ctx = context; - try { - FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder() - .build(); - Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy)); + if (showFILog) { + FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder().build(); + Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy)); + } } catch (Exception ex) { ex.getStackTrace(); } @@ -96,14 +101,10 @@ public InventoryTask(Context context, String appVersion) { /** * This constructor return a Success XML or Error on asynchronous way - * @param context The context to be use - * @param appVersion The name of the agent * @param storeResult Indicate is the result will be stored on file */ - public InventoryTask(Context context, String appVersion, Boolean storeResult) { - this.appVersion = appVersion; + private InventoryTask(Boolean storeResult) { this.storeResult = storeResult; - ctx = context; } /**