mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
This commit is contained in:
parent
55ae9081fd
commit
82c7eefd2e
@ -21,6 +21,7 @@ package org.wso2.carbon.mdm.services.android.util;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonNull;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.apache.commons.logging.Log;
|
||||
@ -371,13 +372,12 @@ public class AndroidDeviceUtils {
|
||||
// {"name":"BATTERY_LEVEL","value":"100"},{"name":"INTERNAL_TOTAL_MEMORY","value":"0.76"}]
|
||||
JsonElement jsonElement = new JsonParser().parse(properties);
|
||||
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
||||
boolean exist = false;
|
||||
for (JsonElement element : jsonArray) {
|
||||
if (element.isJsonObject()) {
|
||||
JsonObject jsonObject = element.getAsJsonObject();
|
||||
if (jsonObject.has("name")
|
||||
&& jsonObject.get("name").getAsString().equalsIgnoreCase(needed)) {
|
||||
if (jsonObject.has("value")) {
|
||||
if (jsonObject.has("value") && jsonObject.get("value") != JsonNull.INSTANCE) {
|
||||
return jsonObject.get("value").getAsString().replace("%", "");
|
||||
} else {
|
||||
return "";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user