Android Question Starting Google Maps from intent

Martin Larsen

Active Member
Licensed User
Longtime 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?
 

Martin Larsen

Active Member
Licensed User
Longtime User
It is a mistake to use that intent as it is an internal intent.

Ok, but I got it from your post. Why doesn't that apply?

In my case, exactly like in that post, I am intercepting a Google Maps link from a webview and want to start Maps externally.
 
Upvote 0

Martin Larsen

Active Member
Licensed User
Longtime 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
Longtime 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
Longtime 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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…