-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from weifengzz/MIUtils_branch
修改MIUIUtils类中isMIUI方法android 8.0以上异常
- Loading branch information
Showing
3 changed files
with
45 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
android/src/main/java/org/wonday/aliyun/push/SystemProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.wonday.aliyun.push; | ||
|
||
import android.content.Context; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
public class SystemProperty { | ||
private final Context mContext; | ||
|
||
public SystemProperty(Context mContext) { | ||
this.mContext = mContext; | ||
} | ||
|
||
public String getOrThrow(String key) throws Exception { | ||
try { | ||
ClassLoader classLoader = mContext.getClassLoader(); | ||
Class SystemProperties = classLoader.loadClass("android.os.SystemProperties"); | ||
Method methodGet = SystemProperties.getMethod("get", String.class); | ||
return (String) methodGet.invoke(SystemProperties, key); | ||
} catch (Exception e) { | ||
throw new Exception(e); | ||
} | ||
} | ||
|
||
public String get(String key) { | ||
try { | ||
return getOrThrow(key); | ||
} catch (Exception e) { | ||
return null; | ||
} | ||
} | ||
|
||
} |