// 校验Tag Alias 只能是数字,英文字母和中文
public static boolean isValidTagAndAlias(String s) {
Pattern p = Pattern.
compile(
"^[\\u4E00-\\u9FA50-9a-zA-Z_@!#$&*+=.|¥¥]+$")
;
Matcher m = p.matcher(s)
;
return m.matches()
;
}
// 取得AppKey
public static String
getAppKey(Context context) {
Bundle metaData =
null;
String appKey =
null;
try {
ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
context.getPackageName()
, PackageManager.
GET_META_DATA)
;
if (
null != ai)
metaData = ai.
metaData;
if (
null != metaData) {
appKey = metaData.getString(
KEY_APP_KEY)
;
if ((
null == appKey) || appKey.length() !=
24) {
appKey =
null;
}
}
}
catch (NameNotFoundException e) {
}
return appKey
;
}
转载请注明原文地址: https://ju.6miu.com/read-1312548.html