Android Question HTML Mailto: in WebView

RichardN

Well-Known Member
Licensed User
Longtime User
I have just been tweaking an old app that has a WebView help page. In the html for this page is an email contact link in the traditional...

B4X:
<a href="mailto:[email protected]?subject=My Database App">Bloggs Software</a>

I believe this used to work fine but now I get an exception with:

Web page not available...
net::ERR_UNKNOWN_URL_SCHEME

Any ideas?


(B4A v8.0 Target SDK 26)
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
There is no App installed which registered a mailto Scheme.
You can probably catch the call in the OverideUrl Event from the Webview.
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
OK @DM we crossed there.... I see you now have to intercept the URL in the WebView_OverrideUrl event and open an intent there.

B4X:
Sub WebViewHelp_OverrideUrl (Url As String) As Boolean
    
    If Url.StartsWith("mailto:") Then
    
        Dim Intent1 As Intent
        Intent1.Initialize(Intent1.ACTION_VIEW, Url)
        StartActivity(Intent1)
        Return True

    End If
    
    Return False
        
End Sub

When/why did that change?
 
Upvote 0
Top