Android Question Starting Google Maps from intent

Martin Larsen

Active Member
Licensed User
I am trying to start Maps from a webview via an intent like here

It works in my emulator, but on my phone I get an exception:

B4X:
android.content.ActivityNotFoundException: Unable to find explicit activity class {android/com.android.internal.app.ResolverActivity}; have you declared this activity in your AndroidManifest.xml?
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2112)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1757)
    at android.app.Activity.startActivityForResult(Activity.java:4803)

A problem with Android version?
 

DonManfred

Expert
Licensed User
A problem with Android version?
i guess the google maps app is missing or outdated on the device.

On my development tablet the app version of GoogleMaps App is: 10.3.0
 
Upvote 0

Martin Larsen

Active Member
Licensed User
Ok that explains it.

But can I start Maps from an url using the geo: intent?

Also, the referred example works fine in the emulator.
 
Upvote 0

Martin Larsen

Active Member
Licensed User
Thanks. It seems that by properly forming the urls in the first case I don't even have to intercept them. They will open in Maps automatically.

Like the example from the guide - that will open in Maps. At least from the main browser - I will try it in a webview.
 
Upvote 0

Martin Larsen

Active Member
Licensed User
At least from the main browser - I will try it in a webview.

These specially formed urls only works in the main browser, not in a webview. Here is just shows the map page in the webview.

But this works:
B4X:
Sub wv_OverrideUrl (Url As String) As Boolean
    Log(Url)
    If Regex.IsMatch2(".*://www.google.\w+/maps/.*", Regex.CASE_INSENSITIVE, Url) Then
        Intent1.Initialize(Intent1.ACTION_VIEW, Url)
        StartActivity(Intent1)
        Return True
    End If
    Return False
End Sub
 
Upvote 0
Top