fix:修复 google 上架被拒问题:获取已安装应用列表,修复华为被拒问题:同意协议前获取设备信息

This commit is contained in:
anfe 2024-06-11 15:48:02 +08:00
parent 57a39ee3b6
commit 27ef3cdbb3
3 changed files with 156 additions and 119 deletions

View File

@ -1,5 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.star_lock"> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation"/> xmlns:tools="http://schemas.android.com/tools"
package="com.example.star_lock">
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
@ -46,8 +51,16 @@
<!-- 相册权限 34适配 --> <!-- 相册权限 34适配 -->
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" /> <uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
<!-- 移除 QUERY_ALL_PACKAGES 权限 -->
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:node="remove" />
<application android:usesCleartextTraffic="true" android:label="@string/app_name" android:name="android.app.Application" android:icon="@mipmap/ic_launcher"> <application
android:name="android.app.Application"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:usesCleartextTraffic="true">
<meta-data <meta-data
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
@ -60,20 +73,24 @@
<meta-data <meta-data
android:name="com.huawei.hms.client.cpid" android:name="com.huawei.hms.client.cpid"
android:value="1406555529261648640" /> android:value="1406555529261648640" />
<meta-data android:name="OPPO_APPKEY" <meta-data
android:name="OPPO_APPKEY"
android:value="OP-47f668c9943248118502aa58d066393b" /> android:value="OP-47f668c9943248118502aa58d066393b" />
<meta-data android:name="OPPO_APPID" <meta-data
android:name="OPPO_APPID"
android:value="OP-31726001" /> android:value="OP-31726001" />
<meta-data android:name="OPPO_APPSECRET" <meta-data
android:name="OPPO_APPSECRET"
android:value="OP-05723986bba64183a71530b496922450" /> android:value="OP-05723986bba64183a71530b496922450" />
<!-- 配置定位Service --> <!-- 配置定位Service -->
<service android:name="com.amap.api.location.APSService" /> <service android:name="com.amap.api.location.APSService" />
<!-- since JPushv3.6.8 oppov2.1.0 oppo 核心功能--> <!-- since JPushv3.6.8 oppov2.1.0 oppo 核心功能-->
<service android:name="cn.jpush.android.service.PluginOppoPushService" <service
android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE" android:name="cn.jpush.android.service.PluginOppoPushService"
android:exported="true"> android:exported="true"
android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE">
<intent-filter> <intent-filter>
<action android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE" /> <action android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE" />
</intent-filter> </intent-filter>
@ -82,8 +99,8 @@
<!-- since JPushv3.6.8 oppov2.1.0 oppo 核心功能--> <!-- since JPushv3.6.8 oppov2.1.0 oppo 核心功能-->
<service <service
android:name="com.heytap.msp.push.service.DataMessageCallbackService" android:name="com.heytap.msp.push.service.DataMessageCallbackService"
android:permission="com.heytap.mcs.permission.SEND_PUSH_MESSAGE" android:exported="true"
android:exported="true"> android:permission="com.heytap.mcs.permission.SEND_PUSH_MESSAGE">
<intent-filter> <intent-filter>
<action android:name="com.heytap.mcs.action.RECEIVE_MCS_MESSAGE" /> <action android:name="com.heytap.mcs.action.RECEIVE_MCS_MESSAGE" />
@ -91,20 +108,33 @@
<action android:name="com.heytap.msp.push.RECEIVE_MCS_MESSAGE" /> <action android:name="com.heytap.msp.push.RECEIVE_MCS_MESSAGE" />
</intent-filter> </intent-filter>
</service> <!--兼容Q版本--> </service> <!--兼容Q版本-->
<activity android:name="com.skychip.lock.MainActivity" android:exported="true" android:screenOrientation="portrait" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> <activity
android:name="com.skychip.lock.MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as <!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. --> to determine the Window background behind the Flutter UI. -->
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme"/> <meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="skysmartlock" /> <data android:scheme="skysmartlock" />
</intent-filter> </intent-filter>

View File

@ -102,15 +102,14 @@ class StarLockLoginLogic extends BaseGetXController {
super.onClose(); super.onClose();
} }
@override //
void onReady() { void flushedDeviceInfo(){
super.onReady();
XSConstantMacro().getDeviceInfoData().then((Map<String, dynamic> data) { XSConstantMacro().getDeviceInfoData().then((Map<String, dynamic> data) {
state.deviceInfoMap.value = data; state.deviceInfoMap.value = data;
}).catchError((error) { }).catchError((dynamic error) {
// //
AppLog.log('获取设备信息时出错: $error'); AppLog.log('获取设备信息时出错: $error');
}); });
} }
} }

View File

@ -10,6 +10,7 @@ import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/login/login/app_get_version.dart'; import 'package:star_lock/login/login/app_get_version.dart';
import 'package:star_lock/login/login/starLock_login_logic.dart';
import 'package:star_lock/main.dart'; import 'package:star_lock/main.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/customer_tool.dart'; import 'package:star_lock/tools/customer_tool.dart';
@ -30,6 +31,9 @@ class AppFirstEnterHandle {
} }
getAppInfo(); getAppInfo();
await privacySDKInitialization(); await privacySDKInitialization();
if (Get.isRegistered<StarLockLoginLogic>()) {
Get.find<StarLockLoginLogic>().flushedDeviceInfo();
}
break; break;
case isAgreePosition: // case isAgreePosition: //
if (getFlag != isAgreePosition) { if (getFlag != isAgreePosition) {
@ -87,7 +91,8 @@ class AppFirstEnterHandle {
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
// //
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{ Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
"url": XSConstantMacro.userAgreementURL, "url": XSConstantMacro.userAgreementURL,
"title": '用户协议'.tr "title": '用户协议'.tr
}); });
@ -101,7 +106,8 @@ class AppFirstEnterHandle {
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
// //
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{ Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
"url": XSConstantMacro.privacyPolicyURL, "url": XSConstantMacro.privacyPolicyURL,
"title": '隐私政策'.tr "title": '隐私政策'.tr
}); });
@ -154,7 +160,8 @@ class AppFirstEnterHandle {
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
// //
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{ Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
"url": XSConstantMacro.userAgreementURL, "url": XSConstantMacro.userAgreementURL,
"title": '用户协议'.tr "title": '用户协议'.tr
}); });
@ -169,7 +176,8 @@ class AppFirstEnterHandle {
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
// //
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{ Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
"url": XSConstantMacro.privacyPolicyURL, "url": XSConstantMacro.privacyPolicyURL,
"title": '隐私政策'.tr "title": '隐私政策'.tr
}); });