Я работаю над приложением для Android, которое генерирует пути к местам тренировок в виде закодированной ломаной линии, и я хочу отображать закодированную ломаную линию в приложении Google Maps с намерением карты Google (https://developers.google.com/maps/documentation /urls/android-intents)
Я размещаю вопрос в Google Gemini и ChatGPT и получаю разные ответы, но никто не работает.
Примеры (среди прочих) ответов, полученных от Gemini и ChatGPT IA
Google Gemini
String encodedPolylineString = "your_encoded_polyline";
// Decode the polyline (replace with your implementation or use a library)
List decodedPoints = PolyUtil.decode(encodedPolylineString);
// Create the intent
Intent intent = new Intent(Intent.ACTION_VIEW);
String dataUri = "geo:0,0?q=polyline:" + encodedPolylineString;
intent.setData(Uri.parse(dataUri));
intent.setPackage("com.google.android.apps.maps");
// Start the activity (optional)
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
} else {
// Handle case where Google Maps is not installed
}
ChatGPT
// Example encoded polyline (make sure to replace this with your actual encoded polyline)
String encodedPolyline = "encoded_polyline_string_here";
// Create the URI for the encoded polyline
Uri gmmIntentUri = Uri.parse("https://www.google.com/maps/dir/?api=1& ... g&path=enc:" + encodedPolyline);
// Create an Intent from gmmIntentUri
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
// Set the package to ensure that the intent is handled by Google Maps
mapIntent.setPackage("com.google.android.apps.maps");
// Check if the intent resolves to an activity (i.e., Google Maps is installed)
if (mapIntent.resolveActivity(getPackageManager()) != null) {
startActivity(mapIntent);
} else {
// Handle the case where Google Maps is not installed
// You could show a message to the user or redirect them to install Google Maps
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... an-android
Есть ли способ отобразить закодированную полилинию в приложении Google Maps с намерением Android? ⇐ JAVA
Программисты JAVA общаются здесь
1719262080
Anonymous
Я работаю над приложением для Android, которое генерирует пути к местам тренировок в виде закодированной ломаной линии, и я хочу отображать закодированную ломаную линию в приложении Google Maps с намерением карты Google (https://developers.google.com/maps/documentation /urls/android-intents)
Я размещаю вопрос в Google Gemini и ChatGPT и получаю разные ответы, но никто не работает.
Примеры (среди прочих) ответов, полученных от Gemini и ChatGPT IA
[b]Google Gemini[/b]
String encodedPolylineString = "your_encoded_polyline";
// Decode the polyline (replace with your implementation or use a library)
List decodedPoints = PolyUtil.decode(encodedPolylineString);
// Create the intent
Intent intent = new Intent(Intent.ACTION_VIEW);
String dataUri = "geo:0,0?q=polyline:" + encodedPolylineString;
intent.setData(Uri.parse(dataUri));
intent.setPackage("com.google.android.apps.maps");
// Start the activity (optional)
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
} else {
// Handle case where Google Maps is not installed
}
[b]ChatGPT[/b]
// Example encoded polyline (make sure to replace this with your actual encoded polyline)
String encodedPolyline = "encoded_polyline_string_here";
// Create the URI for the encoded polyline
Uri gmmIntentUri = Uri.parse("https://www.google.com/maps/dir/?api=1&travelmode=driving&path=enc:" + encodedPolyline);
// Create an Intent from gmmIntentUri
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
// Set the package to ensure that the intent is handled by Google Maps
mapIntent.setPackage("com.google.android.apps.maps");
// Check if the intent resolves to an activity (i.e., Google Maps is installed)
if (mapIntent.resolveActivity(getPackageManager()) != null) {
startActivity(mapIntent);
} else {
// Handle the case where Google Maps is not installed
// You could show a message to the user or redirect them to install Google Maps
}
Подробнее здесь: [url]https://stackoverflow.com/questions/78664535/is-ther-a-way-to-display-an-encoded-polyline-in-google-maps-app-with-an-android[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия