From 7b93548b0b1c517e4794f0e4dd5d618ad77e26f2 Mon Sep 17 00:00:00 2001 From: Azuo Date: Mon, 16 Aug 2021 12:39:11 +0800 Subject: [PATCH] Use any available Maps app, not just explicitly Google Maps. --- .../tommasoberlose/anotherwidget/helpers/IntentHelper.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt index d0c6a08..4c4bae0 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt @@ -45,14 +45,14 @@ object IntentHelper { } fun getGoogleMapsIntentFromAddress(context: Context, address: String): Intent { - val gmmIntentUri: Uri = Uri.parse("geo:0,0?q=$address") + val gmmIntentUri: Uri = Uri.parse("geo:0,0?q=${Uri.encode(address)}") val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) - mapIntent.`package` = "com.google.android.apps.maps" + //mapIntent.`package` = "com.google.android.apps.maps" return if (mapIntent.resolveActivity(context.packageManager) != null) { mapIntent } else { - val map = "http://maps.google.co.in/maps?q=$address" + val map = "https://www.google.com/maps/search/?api=1&query=${Uri.encode(address)}" val i = Intent(Intent.ACTION_VIEW, Uri.parse(map)); i }