diff --git a/android/build.gradle.kts b/android/build.gradle.kts
index 88678470b..533e00619 100644
--- a/android/build.gradle.kts
+++ b/android/build.gradle.kts
@@ -35,7 +35,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10")
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24")
// 其他依赖...
}
}
diff --git a/lib/modules/chat/controllers/chat_controller.dart b/lib/modules/chat/controllers/chat_controller.dart
index 2f7fd5f70..40e372c43 100644
--- a/lib/modules/chat/controllers/chat_controller.dart
+++ b/lib/modules/chat/controllers/chat_controller.dart
@@ -1,6 +1,6 @@
import 'dart:async';
import 'dart:convert';
-import 'package:amap_flutter/amap_flutter.dart';
+import 'package:amap_service/amap_service.dart';
import '../../../data/services/spotify_service.dart';
import 'package:get/get.dart';
import 'package:flutter/widgets.dart';
@@ -32,7 +32,7 @@ class ChatController extends GetxController {
// 添加ScrollController用于控制列表滚动
final ScrollController scrollController = ScrollController();
- final _amapFlutter = AmapFlutter();
+ final _amapFlutter = AmapService();
StreamSubscription? _locationStream;
String _latLng = '';
String _city = '深圳市';
diff --git a/lib/modules/splash/controllers/splash_controller.dart b/lib/modules/splash/controllers/splash_controller.dart
index 2788962eb..76ae34060 100644
--- a/lib/modules/splash/controllers/splash_controller.dart
+++ b/lib/modules/splash/controllers/splash_controller.dart
@@ -1,5 +1,5 @@
import 'dart:async';
-import 'package:amap_flutter/amap_flutter.dart';
+// import 'package:amap_flutter/amap_flutter.dart';
import 'package:deep_voice/data/models/appconfig.dart';
import 'package:deep_voice/data/models/appconfig_model.dart';
import 'package:flutter/material.dart';
@@ -32,21 +32,21 @@ class SplashController extends GetxController {
WidgetsBinding.instance.addPostFrameCallback((_) {
_startLoadingAnimation();
_loadAppResources();
- _initMapSDK();
+ // _initMapSDK();
});
}
// 初始化地图SDK
- void _initMapSDK() {
- try {
- AmapFlutter().initSdk(
- iosKey: "a4a1394fe817c2f86a424b897b4a9af4",
- androidKey: "e5fdc9605eabdeb5626f18f5721f343d",
- );
- } catch (e) {
- print('地图SDK初始化失败: $e');
- }
- }
+ // void _initMapSDK() {
+ // try {
+ // AmapFlutter().initSdk(
+ // iosKey: "a4a1394fe817c2f86a424b897b4a9af4",
+ // androidKey: "e5fdc9605eabdeb5626f18f5721f343d",
+ // );
+ // } catch (e) {
+ // print('地图SDK初始化失败: $e');
+ // }
+ // }
// 进度条动画(持续2秒)
void _startLoadingAnimation() {
diff --git a/local_plugins/agent_service/android/build.gradle.kts b/local_plugins/agent_service/android/build.gradle.kts
index b6c1b4d21..4b810b2be 100644
--- a/local_plugins/agent_service/android/build.gradle.kts
+++ b/local_plugins/agent_service/android/build.gradle.kts
@@ -49,4 +49,5 @@ dependencies {
add("compileOnly", project(":chat_storage"))
add("compileOnly", project(":ble_service"))
add("compileOnly", project(":music_service"))
+ add("compileOnly", project(":amap_service"))
}
\ No newline at end of file
diff --git a/local_plugins/agent_service/android/settings.gradle.kts b/local_plugins/agent_service/android/settings.gradle.kts
index 0aa37a16f..5a2e916cc 100644
--- a/local_plugins/agent_service/android/settings.gradle.kts
+++ b/local_plugins/agent_service/android/settings.gradle.kts
@@ -6,10 +6,11 @@ include(":open_ai_service")
include(":deepvoice_utils")
include(":chat_storage")
include(":music_service")
-
+include(":amap_service")
// 设置项目路径
project(":azure_speech").projectDir = file("../../azure_speech/android")
project(":open_ai_service").projectDir = file("../../open_ai_service/android")
project(":deepvoice_utils").projectDir = file("../../deepvoice_utils/android")
project(":chat_storage").projectDir = file("../../chat_storage/android")
-project(":music_service").projectDir = file("../../music_service/android")
\ No newline at end of file
+project(":music_service").projectDir = file("../../music_service/android")
+project(":amap_service").projectDir = file("../../amap_service/android")
\ No newline at end of file
diff --git a/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt b/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt
index 56fbded96..41c2aa990 100644
--- a/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt
+++ b/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt
@@ -8,6 +8,7 @@ import com.yunqiinnovation.azure_speech.AzureTtsHelper
import com.yunqiinnovation.open_ai_service.OpenAIService
import com.yunqiinnovation.chat_storage.ChatStorageHelper
import com.yunqiinnovation.music_service.MusicServiceStarter
+import com.yunqiinnovation.amap_service.NavigationServiceStarter
import com.yunqiinnovation.deepvoice_utils.FileLogger
import io.flutter.plugin.common.MethodChannel
import kotlinx.coroutines.*
@@ -671,7 +672,7 @@ object AgentService : CoroutineScope {
"result" to functionCallResult.toString(),
))
FileLogger.d(TAG, "mcp调用结果: $functionCallResult")
- metadata = autoPlayMusic(functionCallResult);
+ metadata = autoHandleFcunCallResult(functionCallResult);
}
}
)
@@ -1019,7 +1020,7 @@ object AgentService : CoroutineScope {
/*
* 自动播放音乐
* */
- fun autoPlayMusic(functionCallResult: JSONObject): String{
+ fun autoHandleFcunCallResult(functionCallResult: JSONObject): String{
val metaStr = functionCallResult.optString("meta")
if (metaStr.isNotEmpty()) {
val meta = JSONObject(metaStr)
@@ -1056,6 +1057,11 @@ object AgentService : CoroutineScope {
} else {
FileLogger.w(TAG, "card_musiclist.musics 不是一个数组")
}
+ }else if (meta.has("card_navigation")) { //导航服务
+ val cardNavigation = meta.getJSONObject("card_navigation")
+ val start = cardNavigation.optString("start", "")
+ val end = cardNavigation.optString("end", "")
+ processNavigation(start,end);
}
return metaStr;
}
@@ -1096,4 +1102,23 @@ object AgentService : CoroutineScope {
FileLogger.i(TAG, "音乐列表为空,未启动播放服务")
}
}
+
+ /**
+ * 处理导航
+ * 将ai返回的音乐连接 在后台启动播放
+ *
+ * @param musicUrl 图片文件路径
+ * @param name 歌曲名称,默认为空
+ * @param singer 歌手,默认为false
+ * @return 是否成功开始处理
+ */
+ fun processNavigation(start:String,end:String){
+ // 如果 playlist 中有有效的歌曲,开始播放
+ if (!start.isNullOrEmpty() && !end.isNullOrEmpty()) {
+ FileLogger.i(TAG, "启动导航服务 ${start} ${end}")
+ NavigationServiceStarter.startServiceWithCommand(context, command = "start", startpos = start, endpos = end)
+ } else {
+ FileLogger.i(TAG, "启动导航服务失败")
+ }
+ }
}
\ No newline at end of file
diff --git a/local_plugins/agent_service/pubspec.yaml b/local_plugins/agent_service/pubspec.yaml
index a12f742b4..04ff16b78 100644
--- a/local_plugins/agent_service/pubspec.yaml
+++ b/local_plugins/agent_service/pubspec.yaml
@@ -21,6 +21,8 @@ dependencies:
path: ../chat_storage
music_service:
path: ../music_service
+ amap_service:
+ path: ../amap_service
get: ^4.6.5
dev_dependencies:
diff --git a/local_plugins/amap_flutter/android/settings.gradle b/local_plugins/amap_flutter/android/settings.gradle
deleted file mode 100644
index 5f1ba0ee8..000000000
--- a/local_plugins/amap_flutter/android/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = 'amap_flutter'
diff --git a/local_plugins/amap_flutter/android/src/main/AndroidManifest.xml b/local_plugins/amap_flutter/android/src/main/AndroidManifest.xml
deleted file mode 100644
index 3d69995fd..000000000
--- a/local_plugins/amap_flutter/android/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
diff --git a/local_plugins/amap_flutter/android/src/main/java/com/example/amap_flutter/AmapFlutterPlugin.java b/local_plugins/amap_flutter/android/src/main/java/com/example/amap_flutter/AmapFlutterPlugin.java
deleted file mode 100644
index 08bc360e9..000000000
--- a/local_plugins/amap_flutter/android/src/main/java/com/example/amap_flutter/AmapFlutterPlugin.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package com.example.amap_flutter;
-
-import android.content.Context;
-import androidx.annotation.NonNull;
-import android.util.Log;
-
-import com.amap.api.location.AMapLocation;
-import com.amap.api.location.AMapLocationClient;
-import com.amap.api.location.AMapLocationClientOption;
-import com.amap.api.location.AMapLocationListener;
-
-import io.flutter.embedding.engine.plugins.FlutterPlugin;
-import io.flutter.plugin.common.EventChannel;
-import io.flutter.plugin.common.MethodCall;
-import io.flutter.plugin.common.MethodChannel;
-import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
-import io.flutter.plugin.common.MethodChannel.Result;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/** AmapFlutterPlugin */
-public class AmapFlutterPlugin implements FlutterPlugin, MethodCallHandler {
- /// The MethodChannel that will the communication between Flutter and native Android
- ///
- /// This local reference serves to register the plugin with the Flutter Engine and unregister it
- /// when the Flutter Engine is detached from the Activity
- private MethodChannel methodChannel;
- private EventChannel eventChannel;
- private Context applicationContext;
- private AMapLocationClient mLocationClient;
- private EventChannel.EventSink eventSink;
-
- @Override
- public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
- applicationContext = flutterPluginBinding.getApplicationContext();
- methodChannel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "amap_flutter");
- methodChannel.setMethodCallHandler(this);
-
- // 初始化EventChannel
- eventChannel = new EventChannel(flutterPluginBinding.getBinaryMessenger(), "amap_flutter/events");
- eventChannel.setStreamHandler(new EventChannel.StreamHandler() {
- @Override
- public void onListen(Object arguments, EventChannel.EventSink events) {
- eventSink = events;
- }
-
- @Override
- public void onCancel(Object arguments) {
- eventSink = null;
- }
- });
- }
-
- @Override
- public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
- switch (call.method) {
- case "setApiKey":
- setApiKey(call, result);
- break;
- case "initLocation":
- initLocation(result);
- break;
- case "startLocation":
- startLocation(result);
- break;
- case "stopLocation":
- stopLocation(result);
- break;
- case "dispose":
- dispose(result);
- break;
- default:
- result.notImplemented();
- }
- }
-
- private void setApiKey(MethodCall call, Result result) {
- try {
- String apiKey = call.argument("androidKey");
- AMapLocationClient.updatePrivacyShow(applicationContext, true, true);
- AMapLocationClient.updatePrivacyAgree(applicationContext, true);
- result.success(null);
- } catch (Exception e) {
- result.error("INIT_ERROR", "初始化失败", e.getMessage());
- }
- }
-
- private void initLocation(Result result) {
- try {
- mLocationClient = new AMapLocationClient(applicationContext);
-
- // 配置定位参数
- AMapLocationClientOption option = new AMapLocationClientOption();
- option.setOnceLocation(true);
- option.setNeedAddress(true);
- mLocationClient.setLocationOption(option);
-
- mLocationClient.setLocationListener(mLocationListener);
- result.success(null);
- } catch (Exception e) {
- result.error("INIT_ERROR", "初始化失败", e.getMessage());
- }
- }
-
- private void startLocation(Result result) {
- mLocationClient.startLocation();
- result.success(null);
- }
-
- private void stopLocation(Result result) {
- destroyLocationClient();
- result.success(null);
- }
-
- private void dispose(Result result) {
- try {
- destroyLocationClient();
- result.success(null);
- } catch (Exception e) {
- result.error("DISPOSE_ERROR", "资源释放失败", e.getMessage());
- }
- }
-
- private void destroyLocationClient() {
- if (mLocationClient != null) {
- try {
- // 停止定位
- mLocationClient.stopLocation();
- // 销毁定位客户端
- mLocationClient.onDestroy();
- mLocationClient = null;
-
- // 关闭事件通道
- if (eventSink != null) {
- eventSink.endOfStream();
- eventSink = null;
- }
- } catch (Exception e) {
- Log.e("AmapFlutter", "销毁定位客户端失败", e);
- }
- }
- }
-
- AMapLocationListener mLocationListener = new AMapLocationListener() {
- @Override
- public void onLocationChanged(AMapLocation amapLocation) {
- if (eventSink == null) return;
-
- if (amapLocation != null) {
- if (amapLocation.getErrorCode() == 0) {
- Map locationData = new HashMap<>();
- locationData.put("latitude", amapLocation.getLatitude());
- locationData.put("longitude", amapLocation.getLongitude());
- locationData.put("city", amapLocation.getCity());
- locationData.put("address", amapLocation.getAddress());
- eventSink.success(locationData);
- }
- }
- }
- };
-
- @Override
- public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
- methodChannel.setMethodCallHandler(null);
- eventChannel.setStreamHandler(null);
- destroyLocationClient();
- }
-}
diff --git a/local_plugins/amap_flutter/lib/amap_flutter.dart b/local_plugins/amap_flutter/lib/amap_flutter.dart
deleted file mode 100644
index 6e4c0645c..000000000
--- a/local_plugins/amap_flutter/lib/amap_flutter.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-import 'amap_flutter_platform_interface.dart';
-
-class AmapFlutter {
- // 初始化SDK
- Future initSdk({String? iosKey, String? androidKey}) async {
- await AmapFlutterPlatform.instance.setApiKey(
- iosKey: iosKey,
- androidKey: androidKey,
- );
- }
-
- // 定位初始化
- Future initLocation() async {
- return AmapFlutterPlatform.instance.initLocation();
- }
-
- // 开始定位
- Future startLocation() async {
- return AmapFlutterPlatform.instance.startLocation();
- }
-
- // 监听定位返回位置
- Stream locationStream() {
- return AmapFlutterPlatform.instance.locationStream();
- }
-
- // 停止定位
- Future stopLocation() async {
- await AmapFlutterPlatform.instance.stopLocation();
- }
-
- // 销毁
- Future dispose() async {
- await AmapFlutterPlatform.instance.dispose();
- }
-}
diff --git a/local_plugins/amap_flutter/lib/amap_flutter_method_channel.dart b/local_plugins/amap_flutter/lib/amap_flutter_method_channel.dart
deleted file mode 100644
index 470a9a322..000000000
--- a/local_plugins/amap_flutter/lib/amap_flutter_method_channel.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-import 'package:flutter/foundation.dart';
-import 'package:flutter/services.dart';
-
-import 'amap_flutter_platform_interface.dart';
-
-/// An implementation of [AmapFlutterPlatform] that uses method channels.
-class MethodChannelAmapFlutter extends AmapFlutterPlatform {
- /// The method channel used to interact with the native platform.
- @visibleForTesting
- final methodChannel = const MethodChannel('amap_flutter');
- final eventChannel = const EventChannel('amap_flutter/events');
-
- @override
- Future setApiKey({String? iosKey, String? androidKey}) async {
- await methodChannel.invokeMethod('setApiKey', {
- "iosKey": iosKey,
- "androidKey": androidKey,
- });
- }
-
- @override
- Future initLocation() async {
- return await methodChannel.invokeMethod('initLocation');
- }
-
- @override
- Future startLocation() async {
- return await methodChannel.invokeMethod('startLocation');
- }
-
- @override
- Stream locationStream() {
- return eventChannel.receiveBroadcastStream();
- }
-
- @override
- Future stopLocation() async {
- await methodChannel.invokeMethod('stopLocation');
- }
-
- @override
- Future dispose() async {
- await methodChannel.invokeMethod('dispose');
- }
-}
diff --git a/local_plugins/amap_flutter/lib/amap_flutter_platform_interface.dart b/local_plugins/amap_flutter/lib/amap_flutter_platform_interface.dart
deleted file mode 100644
index dd1c168c1..000000000
--- a/local_plugins/amap_flutter/lib/amap_flutter_platform_interface.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-import 'package:plugin_platform_interface/plugin_platform_interface.dart';
-
-import 'amap_flutter_method_channel.dart';
-
-abstract class AmapFlutterPlatform extends PlatformInterface {
- /// Constructs a AmapFlutterPlatform.
- AmapFlutterPlatform() : super(token: _token);
-
- static final Object _token = Object();
-
- static AmapFlutterPlatform _instance = MethodChannelAmapFlutter();
-
- /// The default instance of [AmapFlutterPlatform] to use.
- ///
- /// Defaults to [MethodChannelAmapFlutter].
- static AmapFlutterPlatform get instance => _instance;
-
- /// Platform-specific implementations should set this with their own
- /// platform-specific class that extends [AmapFlutterPlatform] when
- /// they register themselves.
- static set instance(AmapFlutterPlatform instance) {
- PlatformInterface.verifyToken(instance, _token);
- _instance = instance;
- }
-
- Future setApiKey({String? iosKey, String? androidKey}) {
- throw UnimplementedError('init() has not been implemented.');
- }
-
- Future initLocation() {
- throw UnimplementedError('initLocation() has not been implemented.');
- }
-
- Future startLocation() {
- throw UnimplementedError('startLocation() has not been implemented.');
- }
-
- Stream locationStream() {
- throw UnimplementedError('locationStream() has not been implemented.');
- }
-
- Future stopLocation() {
- throw UnimplementedError('stopLocation() has not been implemented.');
- }
-
- Future dispose() {
- throw UnimplementedError('dispose() has not been implemented.');
- }
-}
diff --git a/local_plugins/amap_flutter/.gitignore b/local_plugins/amap_service/.gitignore
similarity index 100%
rename from local_plugins/amap_flutter/.gitignore
rename to local_plugins/amap_service/.gitignore
diff --git a/local_plugins/amap_flutter/.metadata b/local_plugins/amap_service/.metadata
similarity index 61%
rename from local_plugins/amap_flutter/.metadata
rename to local_plugins/amap_service/.metadata
index a5700b901..cff4c42e1 100644
--- a/local_plugins/amap_flutter/.metadata
+++ b/local_plugins/amap_service/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1"
+ revision: "c23637390482d4cf9598c3ce3f2be31aa7332daf"
channel: "stable"
project_type: plugin
@@ -13,14 +13,14 @@ project_type: plugin
migration:
platforms:
- platform: root
- create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
- platform: android
- create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
- platform: ios
- create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
# User provided section
diff --git a/local_plugins/amap_flutter/CHANGELOG.md b/local_plugins/amap_service/CHANGELOG.md
similarity index 100%
rename from local_plugins/amap_flutter/CHANGELOG.md
rename to local_plugins/amap_service/CHANGELOG.md
diff --git a/local_plugins/amap_flutter/LICENSE b/local_plugins/amap_service/LICENSE
similarity index 100%
rename from local_plugins/amap_flutter/LICENSE
rename to local_plugins/amap_service/LICENSE
diff --git a/local_plugins/amap_flutter/README.md b/local_plugins/amap_service/README.md
similarity index 96%
rename from local_plugins/amap_flutter/README.md
rename to local_plugins/amap_service/README.md
index 8ad963d6d..07e5a93e1 100644
--- a/local_plugins/amap_flutter/README.md
+++ b/local_plugins/amap_service/README.md
@@ -1,4 +1,4 @@
-# amap_flutter
+# amap_service
A new Flutter project.
diff --git a/local_plugins/amap_flutter/analysis_options.yaml b/local_plugins/amap_service/analysis_options.yaml
similarity index 100%
rename from local_plugins/amap_flutter/analysis_options.yaml
rename to local_plugins/amap_service/analysis_options.yaml
diff --git a/local_plugins/amap_flutter/android/.gitignore b/local_plugins/amap_service/android/.gitignore
similarity index 100%
rename from local_plugins/amap_flutter/android/.gitignore
rename to local_plugins/amap_service/android/.gitignore
diff --git a/local_plugins/amap_flutter/android/build.gradle b/local_plugins/amap_service/android/build.gradle
similarity index 57%
rename from local_plugins/amap_flutter/android/build.gradle
rename to local_plugins/amap_service/android/build.gradle
index 393dff90b..4bd0a8a1d 100644
--- a/local_plugins/amap_flutter/android/build.gradle
+++ b/local_plugins/amap_service/android/build.gradle
@@ -1,7 +1,8 @@
-group = "com.example.amap_flutter"
-version = "1.0"
+group = "com.yunqiinnovation.amap_service"
+version = "1.0-SNAPSHOT"
buildscript {
+ ext.kotlin_version = "1.8.22"
repositories {
google()
mavenCentral()
@@ -9,10 +10,11 @@ buildscript {
dependencies {
classpath("com.android.tools.build:gradle:8.7.0")
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
}
}
-rootProject.allprojects {
+allprojects {
repositories {
google()
mavenCentral()
@@ -20,9 +22,10 @@ rootProject.allprojects {
}
apply plugin: "com.android.library"
+apply plugin: "kotlin-android"
android {
- namespace = "com.example.amap_flutter"
+ namespace = "com.yunqiinnovation.amap_service"
compileSdk = 35
@@ -31,19 +34,29 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_11
+ }
+
+ sourceSets {
+ main.java.srcDirs += "src/main/kotlin"
+ test.java.srcDirs += "src/test/kotlin"
+ }
+
defaultConfig {
minSdk = 21
}
dependencies {
- implementation 'com.amap.api:3dmap-location-search:latest.integration'
-
- testImplementation("junit:junit:4.13.2")
+ implementation 'com.amap.api:navi-3dmap:latest.integration'
+ testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.mockito:mockito-core:5.0.0")
}
testOptions {
unitTests.all {
+ useJUnitPlatform()
+
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
diff --git a/local_plugins/amap_service/android/settings.gradle b/local_plugins/amap_service/android/settings.gradle
new file mode 100644
index 000000000..7a093a1c7
--- /dev/null
+++ b/local_plugins/amap_service/android/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'amap_service'
diff --git a/local_plugins/amap_service/android/src/main/AndroidManifest.xml b/local_plugins/amap_service/android/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..2b966b420
--- /dev/null
+++ b/local_plugins/amap_service/android/src/main/AndroidManifest.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/local_plugins/amap_service/android/src/main/kotlin/com/yunqiinnovation/amap_service/AmapServicePlugin.kt b/local_plugins/amap_service/android/src/main/kotlin/com/yunqiinnovation/amap_service/AmapServicePlugin.kt
new file mode 100644
index 000000000..020d98a61
--- /dev/null
+++ b/local_plugins/amap_service/android/src/main/kotlin/com/yunqiinnovation/amap_service/AmapServicePlugin.kt
@@ -0,0 +1,54 @@
+package com.yunqiinnovation.amap_service
+
+import android.content.Context
+import android.content.Intent
+import androidx.core.content.ContextCompat
+// import com.yunqiinnovation.deepvoice_utils.FileLogger
+import com.yunqiinnovation.amap_service.NavigationServiceStarter
+import io.flutter.embedding.engine.plugins.FlutterPlugin
+import io.flutter.plugin.common.MethodCall
+import io.flutter.plugin.common.MethodChannel
+import io.flutter.plugin.common.MethodChannel.MethodCallHandler
+
+
+/** MusicServicePlugin */
+class AmapServicePlugin: FlutterPlugin, MethodCallHandler {
+ private val TAG = "MusicServicePlugin"
+ private lateinit var context: Context
+ private lateinit var channel : MethodChannel
+
+ override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
+ context = flutterPluginBinding.applicationContext
+ channel = MethodChannel(flutterPluginBinding.binaryMessenger, "com.yunqiinnovation.music_service")
+ channel.setMethodCallHandler(this)
+ }
+
+ override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
+ // FileLogger.d(TAG, "Method call: ${call.method}")
+ when (call.method) {
+ "start" -> {
+ val startpos = call.argument("startpos")
+ val endpos = call.argument("endpos")
+ val ntype = call.argument("ntype")
+ if (startpos != null && endpos != null && ntype != null) {
+ NavigationServiceStarter.startServiceWithCommand(context, "start", startpos, endpos, ntype)
+ result.success(null)
+ } else {
+ result.error("INVALID_ARGUMENT", "Missing 'song' map", null)
+ }
+ }
+ "stop" -> {
+ val songs = call.argument>>("songs")
+ if (songs != null && songs.isNotEmpty()) {
+ NavigationServiceStarter.startServiceWithCommand(context, "stop")
+ result.success(null)
+ } else {
+ result.error("INVALID_ARGUMENT", "Missing or empty 'songs' list", null)
+ }
+ }
+ else -> result.notImplemented()
+ }
+ }
+
+ override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {}
+}
diff --git a/local_plugins/amap_service/android/src/main/kotlin/com/yunqiinnovation/amap_service/NavigationService.kt b/local_plugins/amap_service/android/src/main/kotlin/com/yunqiinnovation/amap_service/NavigationService.kt
new file mode 100644
index 000000000..04b4e07b7
--- /dev/null
+++ b/local_plugins/amap_service/android/src/main/kotlin/com/yunqiinnovation/amap_service/NavigationService.kt
@@ -0,0 +1,314 @@
+package com.yunqiinnovation.amap_service
+
+import android.app.NotificationChannel
+import android.app.NotificationManager
+import android.app.Service
+import android.content.Context
+import android.content.Intent
+import android.os.Build
+import android.os.IBinder
+import android.util.Log
+import androidx.core.app.NotificationCompat
+import com.amap.api.navi.AMapNavi
+import com.amap.api.navi.AMapNaviListener
+import com.amap.api.navi.enums.NaviType
+import com.amap.api.navi.enums.PathPlanningStrategy
+import com.amap.api.navi.model.AMapCalcRouteResult
+import com.amap.api.navi.model.AMapLaneInfo
+import com.amap.api.navi.model.AMapModelCross
+import com.amap.api.navi.model.AMapNaviCameraInfo
+import com.amap.api.navi.model.AMapNaviCross
+import com.amap.api.navi.model.AMapNaviLocation
+import com.amap.api.navi.model.AMapNaviRouteNotifyData
+import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo
+import com.amap.api.navi.model.AMapServiceAreaInfo
+import com.amap.api.navi.model.AimLessModeCongestionInfo
+import com.amap.api.navi.model.AimLessModeStat
+import com.amap.api.navi.model.NaviInfo
+import com.amap.api.navi.model.NaviLatLng
+import java.io.FileNotFoundException
+import java.util.concurrent.atomic.AtomicBoolean
+
+
+class NavigationService: Service() {
+
+ companion object {
+ private const val TAG = "NavigationService"
+ private const val CHANNEL_ID = "navigation_channel"
+ private const val CHANNEL_Name = "导航服务"
+ private const val NOTIFICATION_ID = 1003
+
+ private val isRunning = AtomicBoolean(false)
+ private var startpos: String = ""
+ private var endpos: String = ""
+ private var naviType: String? = null
+ private var playlist = mutableListOf