2.8 编写一个通用的广播模式,action:chaoran.crtech.cn.pda.scan key:barcode;并且写了一个固定的注册码,但是这个注册码只能注册一个小时

This commit is contained in:
2025-06-25 11:04:14 +08:00
parent d949619023
commit 46b6b43a0f
4 changed files with 57 additions and 6 deletions

View File

@ -69,9 +69,6 @@ public class LocalAddressUtil {
@JavascriptInterface
public String getMacAddress(){//可以兼容安卓7以下
SharedPreferences spf = context.getSharedPreferences("chaoran_mac", Context.MODE_PRIVATE);
SharedPreferences.Editor editor1 = context.getSharedPreferences("CrtechPdaConfig", Context.MODE_PRIVATE).edit();
editor1.putString("checkMacTime", String.valueOf(System.currentTimeMillis() - 1 * 60 * 60 * 1000));
editor1.commit();
String saveMac = spf.getString("chaoran_mac", "");
if (!"".equalsIgnoreCase(saveMac)) {
return saveMac;
@ -243,9 +240,9 @@ public class LocalAddressUtil {
return "error";
}
if ("1".equals(sharedPreferences.getString("checkMacType", "0"))) {
// 判断是否是强行注册的,强行注册的只允许使用一;一但判断到,就取消注册
// 判断是否是强行注册的,强行注册的只允许使用一个小时;一但判断到,就取消注册
Long aLong = Long.valueOf(sharedPreferences.getString("checkMacTime", String.valueOf(System.currentTimeMillis())));
if ((aLong + 1 * 60 * 1000) < System.currentTimeMillis()) {
if ((aLong + 1 * 60 * 60 * 1000) < System.currentTimeMillis()) {
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putString("checkMac", "error");
edit.commit();