Commit b6cc62f89464d331fc46269d458b221dcce66daa
1 parent
3bf22e37
1 修复锤子手机检测电池忽略优化白名单闪退问题
2 修改地理围栏去噪精度
Showing
3 changed files
with
27 additions
and
16 deletions
config.gradle
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
| @@ -39,7 +39,7 @@ public class Constant { | @@ -39,7 +39,7 @@ public class Constant { | ||
| 39 | public static final int LOCA_ACCURACY = 20;//定位过滤精度 | 39 | public static final int LOCA_ACCURACY = 20;//定位过滤精度 |
| 40 | public static final int LOCA_END_POINT_ACCURACY = 20;//终点位置比较精度 | 40 | public static final int LOCA_END_POINT_ACCURACY = 20;//终点位置比较精度 |
| 41 | public static final int LOCA_START_POINT_ACCURACY = 20;//起点位置比较精度 | 41 | public static final int LOCA_START_POINT_ACCURACY = 20;//起点位置比较精度 |
| 42 | - public static final int FENCE_OFFSET = 70;//围栏偏离距离 | ||
| 43 | - public static final int FENCE_DENOISE = 70;//围栏去噪精度 | 42 | + public static final int FENCE_OFFSET = 50;//围栏偏离距离 |
| 43 | + public static final int FENCE_DENOISE = 20;//围栏去噪精度 | ||
| 44 | public static final int TAKE_POINT_MAX_SIZE = 100;//最大打点数量 | 44 | public static final int TAKE_POINT_MAX_SIZE = 100;//最大打点数量 |
| 45 | } | 45 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/CheckUtil.java
| @@ -14,22 +14,33 @@ import static android.content.Context.POWER_SERVICE; | @@ -14,22 +14,33 @@ import static android.content.Context.POWER_SERVICE; | ||
| 14 | 14 | ||
| 15 | public class CheckUtil { | 15 | public class CheckUtil { |
| 16 | 16 | ||
| 17 | + /** | ||
| 18 | + * 锤子手机不能检测电池白名单,会崩溃 | ||
| 19 | + * | ||
| 20 | + * @param context | ||
| 21 | + * @return | ||
| 22 | + */ | ||
| 17 | public static boolean isIgnoringBatteryOptimizationss(Activity context) { | 23 | public static boolean isIgnoringBatteryOptimizationss(Activity context) { |
| 18 | - PowerManager powerManager = (PowerManager) context.getSystemService(POWER_SERVICE); | ||
| 19 | - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { | ||
| 20 | - boolean hasIgnored = powerManager.isIgnoringBatteryOptimizations(context.getPackageName()); | ||
| 21 | - if (!hasIgnored) { | ||
| 22 | - Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); | ||
| 23 | - intent.setData(Uri.parse("package:" + context.getPackageName())); | ||
| 24 | - PackageManager pm = context.getPackageManager(); | ||
| 25 | - if (intent.resolveActivity(pm) != null) { | ||
| 26 | - context.startActivity(intent); | 24 | + String carrier = android.os.Build.MANUFACTURER; |
| 25 | + if (!"smartisan".equals(carrier)) { | ||
| 26 | + PowerManager powerManager = (PowerManager) context.getSystemService(POWER_SERVICE); | ||
| 27 | + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { | ||
| 28 | + boolean hasIgnored = powerManager.isIgnoringBatteryOptimizations(context.getPackageName()); | ||
| 29 | + if (!hasIgnored) { | ||
| 30 | + Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); | ||
| 31 | + intent.setData(Uri.parse("package:" + context.getPackageName())); | ||
| 32 | + PackageManager pm = context.getPackageManager(); | ||
| 33 | + if (intent.resolveActivity(pm) != null) { | ||
| 34 | + context.startActivity(intent); | ||
| 35 | + } | ||
| 36 | + AlertUtil.showDeftToast(context, "请选择允许加入电池优化白名单,否则将会影响您的正常使用!"); | ||
| 37 | + return false; | ||
| 38 | + } else { | ||
| 39 | + return true; | ||
| 27 | } | 40 | } |
| 28 | - AlertUtil.showDeftToast(context, "请选择允许加入电池优化白名单,否则将会影响您的正常使用!"); | ||
| 29 | - return false; | ||
| 30 | - } else { | ||
| 31 | - return true; | ||
| 32 | } | 41 | } |
| 42 | + } else { | ||
| 43 | + return true; | ||
| 33 | } | 44 | } |
| 34 | return false; | 45 | return false; |
| 35 | } | 46 | } |