version:3.1

fix:
update:修改唯一标识为IMEI
This commit is contained in:
2022-07-14 20:06:59 +08:00
parent 11739ccca7
commit 9ab736cb46
6 changed files with 103 additions and 41 deletions

View File

@@ -39,8 +39,8 @@ android {
productFlavors { productFlavors {
beta { beta {
flavorDimensions "default" flavorDimensions "default"
versionCode 19 versionCode 22
versionName "2.8" versionName "3.1"
manifestPlaceholders = [ manifestPlaceholders = [
JPUSH_PKGNAME: "com.uiui.appstore", JPUSH_PKGNAME: "com.uiui.appstore",
JPUSH_APPKEY : "c93d01f43046fa500d162817", //JPush 上注册的包名对应的 Appkey. JPUSH_APPKEY : "c93d01f43046fa500d162817", //JPush 上注册的包名对应的 Appkey.

View File

@@ -119,12 +119,14 @@
<meta-data <meta-data
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" /> android:resource="@xml/file_paths" />
</provider> <!-- Rich push 核心功能 since 2.0.6 --> </provider>
<!-- Rich push 核心功能 since 2.0.6 -->
<activity <activity
android:name="cn.jpush.android.ui.PopWinActivity" android:name="cn.jpush.android.ui.PopWinActivity"
android:exported="false" android:exported="false"
android:theme="@style/MyDialogStyle" android:theme="@style/MyDialogStyle"
tools:replace="android:exported" /> <!-- Required SDK核心功能 --> tools:replace="android:exported" />
<!-- Required SDK核心功能 -->
<activity <activity
android:name="cn.jpush.android.ui.PushActivity" android:name="cn.jpush.android.ui.PushActivity"
android:configChanges="orientation|keyboardHidden" android:configChanges="orientation|keyboardHidden"
@@ -137,7 +139,8 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="com.uiui.appstore" /> <category android:name="com.uiui.appstore" />
</intent-filter> </intent-filter>
</activity> <!-- Required SDK 核心功能 --> </activity>
<!-- Required SDK 核心功能 -->
<!-- 可配置android:process参数将PushService放在其他进程中 --> <!-- 可配置android:process参数将PushService放在其他进程中 -->
<service <service
android:name="cn.jpush.android.service.PushService" android:name="cn.jpush.android.service.PushService"
@@ -149,13 +152,15 @@
<action android:name="cn.jpush.android.intent.PushService" /> <action android:name="cn.jpush.android.intent.PushService" />
<action android:name="cn.jpush.android.intent.PUSH_TIME" /> <action android:name="cn.jpush.android.intent.PUSH_TIME" />
</intent-filter> </intent-filter>
</service> <!-- since 3.0.9 Required SDK 核心功能 --> </service>
<!-- since 3.0.9 Required SDK 核心功能 -->
<provider <provider
android:name="cn.jpush.android.service.DataProvider" android:name="cn.jpush.android.service.DataProvider"
android:authorities="com.uiui.appstore.DataProvider" android:authorities="com.uiui.appstore.DataProvider"
android:exported="false" android:exported="false"
android:process=":pushcore" android:process=":pushcore"
tools:replace="android:authorities" /> <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 --> tools:replace="android:authorities" />
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 --> <!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
<service <service
android:name="cn.jpush.android.service.DaemonService" android:name="cn.jpush.android.service.DaemonService"
@@ -166,18 +171,21 @@
<category android:name="com.uiui.appstore" /> <category android:name="com.uiui.appstore" />
</intent-filter> </intent-filter>
</service> <!-- since 3.1.0 Required SDK 核心功能 --> </service>
<!-- since 3.1.0 Required SDK 核心功能 -->
<provider <provider
android:name="cn.jpush.android.service.DownloadProvider" android:name="cn.jpush.android.service.DownloadProvider"
android:authorities="com.uiui.appstore.DownloadProvider" android:authorities="com.uiui.appstore.DownloadProvider"
android:exported="true" android:exported="true"
tools:replace="android:authorities" /> <!-- Required SDK核心功能 --> tools:replace="android:authorities" />
<!-- Required SDK核心功能 -->
<receiver <receiver
android:name="cn.jpush.android.service.PushReceiver" android:name="cn.jpush.android.service.PushReceiver"
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="false">
<intent-filter android:priority="1000"> <intent-filter android:priority="1000">
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <!-- Required 显示通知栏 --> <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
<!-- Required 显示通知栏 -->
<category android:name="com.uiui.appstore" /> <category android:name="com.uiui.appstore" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
@@ -191,7 +199,8 @@
<data android:scheme="package" /> <data android:scheme="package" />
</intent-filter> </intent-filter>
</receiver> <!-- Required SDK核心功能 --> </receiver>
<!-- Required SDK核心功能 -->
<receiver <receiver
android:name="cn.jpush.android.service.AlarmReceiver" android:name="cn.jpush.android.service.AlarmReceiver"
android:exported="false" /> <!-- since 3.3.0 Required SDK核心功能 --> android:exported="false" /> <!-- since 3.3.0 Required SDK核心功能 -->
@@ -214,20 +223,27 @@
<intent-filter> <intent-filter>
<action android:name="cn.jiguang.user.service.action" /> <action android:name="cn.jiguang.user.service.action" />
</intent-filter> </intent-filter>
</service> <!-- User defined. For test only 用户自定义的广播接收器 --> </service>
<!-- User defined. For test only 用户自定义的广播接收器 -->
<receiver <receiver
android:name="com.uiui.appstore.jpush.MyReceiver" android:name="com.uiui.appstore.jpush.MyReceiver"
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="cn.jpush.android.intent.REGISTRATION" /> <!-- Required 用户注册SDK的intent --> <action android:name="cn.jpush.android.intent.REGISTRATION" />
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!-- Required 用户接收SDK消息的intent --> <!-- Required 用户注册SDK的intent -->
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!-- Required 用户接收SDK通知栏信息的intent --> <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!-- Required 用户打开自定义通知栏的intent --> <!-- Required 用户接收SDK消息的intent -->
<action android:name="cn.jpush.android.intent.CONNECTION" /> <!-- 接收网络变化 连接/断开 since 1.6.3 --> <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
<!-- Required 用户接收SDK通知栏信息的intent -->
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
<!-- Required 用户打开自定义通知栏的intent -->
<action android:name="cn.jpush.android.intent.CONNECTION" />
<!-- 接收网络变化 连接/断开 since 1.6.3 -->
<category android:name="com.uiui.appstore" /> <category android:name="com.uiui.appstore" />
</intent-filter> </intent-filter>
</receiver> <!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调 --> </receiver>
<!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调 -->
<receiver android:name="com.uiui.appstore.jpush.MyJPushMessageReceiver"> <receiver android:name="com.uiui.appstore.jpush.MyJPushMessageReceiver">
<intent-filter> <intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" /> <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />

View File

@@ -61,7 +61,7 @@ public class LocalAppAdapter extends RecyclerView.Adapter<LocalAppAdapter.LocalA
if (localApp.isCanUnintall()) { if (localApp.isCanUnintall()) {
holder.btnDownLoad.setVisibility(View.VISIBLE); holder.btnDownLoad.setVisibility(View.VISIBLE);
} else { } else {
holder.btnDownLoad.setVisibility(View.GONE); holder.btnDownLoad.setVisibility(View.INVISIBLE);
} }
holder.btnDownLoad.setOnClickListener(new View.OnClickListener() { holder.btnDownLoad.setOnClickListener(new View.OnClickListener() {
@Override @Override

View File

@@ -36,9 +36,11 @@ import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
@@ -638,12 +640,25 @@ public class ApkUtils {
} }
} }
static HashSet<String> fuxiaoyingApp = new HashSet<String>() {{
this.add("com.fuying.fuxiaoying");
this.add("com.zhiduoke.fxy");
this.add("com.fuying.english");
this.add("com.pengren.growthspace");
this.add("com.moshujiamm.moshujia");
this.add("com.gankao.gkwxhd");
this.add("com.fuying.aobama.pad");
}};
synchronized public static List<LocalApp> getLocalApp(Context context) { synchronized public static List<LocalApp> getLocalApp(Context context) {
List<LocalApp> appList = new ArrayList<>(); List<LocalApp> appList = new ArrayList<>();
Intent intent = new Intent(Intent.ACTION_MAIN, null); Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> resolveInfoList = context.getPackageManager().queryIntentActivities(intent, 0); List<ResolveInfo> resolveInfoList = context.getPackageManager().queryIntentActivities(intent, 0);
String qch_force_app = Settings.System.getString(context.getContentResolver(), "qch_force_app"); String aole_force_app = Settings.System.getString(context.getContentResolver(), "aole_force_app");
Set<String> forceAppSet = new HashSet<>(Arrays.asList(aole_force_app.split(",")));
forceAppSet.addAll(fuxiaoyingApp);
for (int i = 0; i < resolveInfoList.size(); i++) { for (int i = 0; i < resolveInfoList.size(); i++) {
LocalApp bean = new LocalApp(); LocalApp bean = new LocalApp();
bean.setAppName(resolveInfoList.get(i).loadLabel(context.getPackageManager()).toString()); bean.setAppName(resolveInfoList.get(i).loadLabel(context.getPackageManager()).toString());
@@ -657,7 +672,7 @@ public class ApkUtils {
bean.setPackageName(packageName); bean.setPackageName(packageName);
Drawable icon = resolveInfoList.get(i).loadIcon(context.getPackageManager()); Drawable icon = resolveInfoList.get(i).loadIcon(context.getPackageManager());
bean.setIcon(icon); bean.setIcon(icon);
if (!TextUtils.isEmpty(qch_force_app) && qch_force_app.contains(packageName)) { if (forceAppSet.contains(packageName)) {
bean.setCanUnintall(false); bean.setCanUnintall(false);
} else { } else {
bean.setCanUnintall(true); bean.setCanUnintall(true);

View File

@@ -13,6 +13,7 @@ import android.os.BatteryManager;
import android.os.Build; import android.os.Build;
import android.os.PowerManager; import android.os.PowerManager;
import android.provider.Settings; import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@@ -344,4 +345,34 @@ public class JGYUtils {
bootIntent.setComponent(new ComponentName(PACKAGE_UPDATETOOLS, CLASS_UPDATETOOLS)); bootIntent.setComponent(new ComponentName(PACKAGE_UPDATETOOLS, CLASS_UPDATETOOLS));
mContext.sendBroadcast(bootIntent); mContext.sendBroadcast(bootIntent);
} }
public String getIMEI() {
String IMEI = "unknow";
String IMEI1, IMEI2, IMEI3;
//获取手机设备号
TelephonyManager TelephonyMgr = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
//8.0及以后版本获取
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
IMEI = TelephonyMgr.getDeviceId();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// try {
// Method method = TelephonyMgr.getClass().getMethod("getImei");
// IMEI = (String) method.invoke(TelephonyMgr);
// } catch (Exception e) {
// e.printStackTrace();
// Log.e("getIMEI", e.getMessage());
// }
// IMEI = TelephonyMgr.getDeviceId();
// } else {//9.0到10.0获取
IMEI = Settings.System.getString(mContext.getContentResolver(), Settings.Secure.ANDROID_ID);
}
// Log.e("IMEI:", "IMEI: " + IMEI);
if (null == IMEI) {
return "-";
} else {
return IMEI.toUpperCase();
}
}
} }

View File

@@ -586,22 +586,23 @@ public class Utils {
*/ */
@SuppressLint({"MissingPermission", "NewApi"}) @SuppressLint({"MissingPermission", "NewApi"})
public static String getSerial() { public static String getSerial() {
String serial = "unknow"; return JGYUtils.getInstance().getIMEI();
try { // String serial = "unknow";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+ // try {
serial = Build.getSerial(); // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+ // serial = Build.getSerial();
serial = Build.SERIAL; // } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+
} else {//8.0- // serial = Build.SERIAL;
Class<?> c = Class.forName("android.os.SystemProperties"); // } else {//8.0-
Method get = c.getMethod("get", String.class); // Class<?> c = Class.forName("android.os.SystemProperties");
serial = (String) get.invoke(c, "ro.serialno"); // Method get = c.getMethod("get", String.class);
} // serial = (String) get.invoke(c, "ro.serialno");
} catch (Exception e) { // }
e.printStackTrace(); // } catch (Exception e) {
Log.e("e", "读取设备序列号异常:" + e.toString()); // e.printStackTrace();
} // Log.e("e", "读取设备序列号异常:" + e.toString());
return serial; // }
// return serial;
} }
public static final long A_GB = 1073741824; public static final long A_GB = 1073741824;
@@ -686,6 +687,7 @@ public class Utils {
// mCanvas.drawBitmap(mBitmap, mRect, mRect, mPaint); // mCanvas.drawBitmap(mBitmap, mRect, mRect, mPaint);
// return bgBitmap; // return bgBitmap;
} }
public static Bitmap DrawableToBitmap(Drawable drawable) { public static Bitmap DrawableToBitmap(Drawable drawable) {
// 获取 drawable 长宽 // 获取 drawable 长宽
@@ -707,6 +709,4 @@ public class Utils {
} }
} }