1

I am making a list of stores near me on a map using google maps. How to get a popup where when I select one of these stores it will choose one of the Maps apps downloaded on the phone. When I research about it, I can't find any results. For example, when we want to open a PDF, a popup appears on the device about which application to choose. I want to do similar to this. For example, now I have Yandex and Google Maps application on my phone. I have to make a popup that will select either one. The code below opens only the Google Maps application directly.



   fun openMapApp(office: StoreOffice) {
     weakReference.get()?.run {
      val location = "${office.latitude},${office.longitude}"
      val uri = Uri.parse("geo:${location}?q=${location}(${Uri.parse(office.vendorName)})")

      val intent = Intent(Intent.ACTION_VIEW, uri)
      val chooser = Intent.createChooser(intent, resources.getString(R.string.chooser_title))

      try {
         startActivity(chooser)
      } catch (e: ActivityNotFoundException) {
         AlertDialog.Builder(requireContext())
            .setTitle(R.string.common_warning)
            .setMessage(R.string.app_not_found_message)
            .build()
      }
   }
}

Ae.S
  • 129
  • 1
  • 1
  • 8

1 Answers1

0

From your question, I believe you want a way to choose a navigation app from the list of navigation apps on your phone.

Check out this answer from the question Android intent chooser for navigation apps. It should be of help.

Lekan
  • 115
  • 1
  • 6