From 3a4bd4f19fcfcac6d24ec4d4f973e12ebe72af7a Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期一, 17 六月 2019 11:48:40 +0800
Subject: [PATCH] update 电量监听销毁逻辑保护

---
 Project/app/src/main/java/com/secondworld/univeralsdk/UniversalUtil.java |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/Project/app/src/main/java/com/secondworld/univeralsdk/UniversalUtil.java b/Project/app/src/main/java/com/secondworld/univeralsdk/UniversalUtil.java
index ca642e9..8b2a47c 100644
--- a/Project/app/src/main/java/com/secondworld/univeralsdk/UniversalUtil.java
+++ b/Project/app/src/main/java/com/secondworld/univeralsdk/UniversalUtil.java
@@ -8,6 +8,7 @@
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PermissionInfo;
@@ -354,4 +355,47 @@
 
         return true;
     }
+
+    public static String getMetaString(Activity activity, String key)
+    {
+        PackageManager _pkgMgr = activity.getPackageManager();
+        ApplicationInfo _appInfo;
+        try
+        {
+            _appInfo = _pkgMgr.getApplicationInfo(activity.getPackageName(),
+                                                  PackageManager.GET_META_DATA);
+            return _appInfo.metaData.getString(key);
+        } catch (PackageManager.NameNotFoundException e)
+        {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static int getMetaInt(Activity activity, String key)
+    {
+        LogUtil.i(TAG, "灏嗚鑾峰彇鐨凪etaKey: " + key);
+        PackageManager _pkgMgr = activity.getPackageManager();
+        ApplicationInfo _appInfo;
+        try
+        {
+            _appInfo = _pkgMgr.getApplicationInfo(activity.getPackageName(),
+                                                  PackageManager.GET_META_DATA);
+            return _appInfo.metaData.getInt(key);
+        } catch (PackageManager.NameNotFoundException e)
+        {
+            e.printStackTrace();
+        }
+        return -1;
+    }
+
+    public static boolean isEmpty(String s) {
+        if (null == s)
+            return true;
+        if (s.length() == 0)
+            return true;
+        if (s.trim().length() == 0)
+            return true;
+        return false;
+    }
 }

--
Gitblit v1.8.0