diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 7d244c60a..441e2cafc 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -29,9 +29,9 @@
-
+
diff --git a/lib/data/services/ble_manager.dart b/lib/data/services/ble_manager.dart
index 8708ed994..5d1af6ca3 100644
--- a/lib/data/services/ble_manager.dart
+++ b/lib/data/services/ble_manager.dart
@@ -532,7 +532,7 @@ class BleManager extends GetxService {
try {
// 从.env文件直接读取环境变量
var serverurl = dotenv.env['SERVER_URL'] ?? '';
- if (Get.locale?.countryCode != 'CN') {
+ if (Get.deviceLocale?.countryCode != 'CN') {
serverurl = dotenv.env['HW_SERVER_URL'] ?? '';
}
diff --git a/lib/data/services/version_update_service.dart b/lib/data/services/version_update_service.dart
index e959227ce..a15251857 100644
--- a/lib/data/services/version_update_service.dart
+++ b/lib/data/services/version_update_service.dart
@@ -30,7 +30,9 @@ class VersionUpdateService extends GetxService {
static final String? _countryCode = Get.deviceLocale?.countryCode; //国家地区编码
static final String? _languageCode = Get.deviceLocale?.languageCode; //语言编码
// ignore: non_constant_identifier_names
- static final String? _SERVER_URL = dotenv.env['SERVER_URL']; //服务器地址
+ static final String? _SERVER_URL = (_countryCode == 'CN')
+ ? dotenv.env['SERVER_URL']
+ : dotenv.env['HW_SERVER_URL']; //服务器地址
// 添加 getter 方法来访问缓存的静态数据
/// 获取缓存的应用版本
diff --git a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/tools/SimpleAudioReceiver.kt b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/tools/SimpleAudioReceiver.kt
index 0505ff46d..bec452ee3 100644
--- a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/tools/SimpleAudioReceiver.kt
+++ b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/tools/SimpleAudioReceiver.kt
@@ -16,6 +16,7 @@ import android.media.AudioManager
import android.media.AudioFocusRequest
import android.media.AudioAttributes
import com.yunqiinnovation.azure_speech.tools.RecordFile
+import android.os.Build // 新增:用于获取设备信息
/**
* 简单音频接收器类,用于处理音频录制和流传输
@@ -232,13 +233,35 @@ class SimpleAudioReceiver(private val context: Context) {
}
}
+ /**
+ * 判断是否为荣耀手机
+ * @return true 如果是荣耀手机,false 否则
+ */
+ private fun isHonorDevice(): Boolean {
+ val brand = Build.BRAND?.lowercase() ?: ""
+ val manufacturer = Build.MANUFACTURER?.lowercase() ?: ""
+ val model = Build.MODEL?.lowercase() ?: ""
+
+ // 检查品牌、制造商或型号中是否包含荣耀相关标识
+ return brand.contains("honor") ||
+ manufacturer.contains("honor") ||
+ model.contains("honor") ||
+ brand.contains("荣耀") ||
+ manufacturer.contains("荣耀")
+ }
+
/**
* 运行麦克风捕获
*/
private fun runMicrophoneCapture() {
try {
- // 首先设置通话音频模式
- //setupCommunicationAudioMode()
+ // 根据手机品牌决定是否设置通话音频模式
+ if (isHonorDevice()) {
+ Log.d(TAG, "检测到荣耀设备,启用通话音频模式")
+ setupCommunicationAudioMode()
+ } else {
+ Log.d(TAG, "非荣耀设备,跳过通话音频模式设置")
+ }
val supportedSampleRates = intArrayOf(16000, 8000, 11025, 22050, 44100)
val sampleRate = supportedSampleRates.firstOrNull { rate ->
val bufferSize = AudioRecord.getMinBufferSize(rate, channelConfig, audioFormat)
diff --git a/pubspec.yaml b/pubspec.yaml
index d63c9b133..5906aa5ea 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: voitrans
description: "Voitrans - AI Voice Assistant."
publish_to: "none"
-version: 1.0.10+20
+version: 1.0.10+25
environment:
sdk: ">=3.3.0 <4.0.0"