Skip to content

Commit

Permalink
fix lint error: Criteria.ACCURACY_FINE lint error on Android 12
Browse files Browse the repository at this point in the history
  • Loading branch information
ZCShou committed Jun 17, 2022
1 parent ca554c9 commit 82b4144
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/src/main/java/com/zcshou/service/ServiceGo.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.zcshou.service;

import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
Expand Down Expand Up @@ -203,6 +204,8 @@ private void removeTestProviderGPS() {
}
}

// 注意下面临时添加 @SuppressLint("wrongconstant") 以处理 addTestProvider 参数值的 lint 错误
@SuppressLint("wrongconstant")
private void addTestProviderGPS() {
try {
// 注意,由于 android api 问题,下面的参数会提示错误(以下参数是通过相关API获取的真实GPS参数,不是随便写的)
Expand Down Expand Up @@ -254,6 +257,8 @@ private void removeTestProviderNetwork() {
}
}

// 注意下面临时添加 @SuppressLint("wrongconstant") 以处理 addTestProvider 参数值的 lint 错误
@SuppressLint("wrongconstant")
private void addTestProviderNetwork() {
try {
// 注意,由于 android api 问题,下面的参数会提示错误(以下参数是通过相关API获取的真实NETWORK参数,不是随便写的)
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/zcshou/utils/GoUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.zcshou.utils;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
Expand Down Expand Up @@ -77,7 +78,8 @@ public static boolean isGpsOpened(Context context) {
return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
}

// 判断是否已在开发者选项中开启模拟位置权限
// 判断是否已在开发者选项中开启模拟位置权限(注意下面临时添加 @SuppressLint("wrongconstant") 以处理 addTestProvider 参数值的 lint 错误)
@SuppressLint("wrongconstant")
public static boolean isAllowMockLocation(Context context) {
boolean canMockPosition = false;
int index;
Expand Down

0 comments on commit 82b4144

Please sign in to comment.