I have an application that works according to the map, but I want another software to do the routing
I went so far that it opens the map of that navigation application, but on my own application, but I want it to open inside the same application, not on my own application.
How do I do this?
_launchURL() async {
_getCurrentLocation().then((value) async {
final Uri url =
Uri.parse('https://nshn.ir?origin=${value.latitude},${value.longitude}&destination=$lat,$lon&vehicle=d');
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
});
}
Future<Position> _getCurrentLocation() async {
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
return Future.error("اجازه مکان داده نشده است");
}
LocationPermission permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) {
return Future.error("اجازه مکان داده نمیشود");
}
}
if (permission == LocationPermission.deniedForever) {
return Future.error("اجازه مکان داه نمیشود کلا");
}
return await Geolocator.getCurrentPosition();
}
}
2
Answers
Try This :
In your androidManifest file, inside activity change android:launchMode to single task
Please refer this section
You can use
LaunchMode.externalApplication
for mode parameter