Android Question net::ERR_UNKOWN_URL_SCHEME : WebView issue after following second link

mikejohnsonharp

Member
Licensed User
Longtime User
Dear B4A forum, I know this issue has been brought to reference for other WebView issues, however this one is strange. I am trying to create a fan app "Michael Johnson Harpist" and allow users of the app to access my bandsintown.com concert page . This is the link https://bnds.us/ytr0zq . The WebView works perfectly for most of the links on this website except for the "Tickets" button. It bring up

Web page not available
The web page at intent://bandsintown.page.link/?link=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred&apn=com.bandsintown&amv=229&afl=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred&isi=471394851&ibi=com.bandsintown.bit&ius=bitcon&ifl=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred&imv=6.7&si=https://assets.prod.bandsintown.com/images/deferred-deeplink-image.png&utm_campaign=ticket&utm_medium=web&utm_source=jump_page&gclid=242&efr=1#Intent;package=com.google.android.gms;action=com.google.firebase.dynamiclinks.VIEW_DYNAMIC_LINK;scheme=https;S.browser_fallback_url=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred;end; could not be loaded because:

net::ERR_UNKNOWN_URL_SCHEME

I should also add that there are many links to concerts (all different ) on this site . and they change every month so it would be impossible to include these links as an intent in the manifest as I would have to change the app manifest every month.
Can anyone help me. Cheers, Michael
 

JohnC

Expert
Licensed User
Longtime User
Have you tried adding chromeclient to webview?

 
Upvote 0

sfsameer

Well-Known Member
Licensed User
Longtime User
Dear B4A forum, I know this issue has been brought to reference for other WebView issues, however this one is strange. I am trying to create a fan app "Michael Johnson Harpist" and allow users of the app to access my bandsintown.com concert page . This is the link https://bnds.us/ytr0zq . The WebView works perfectly for most of the links on this website except for the "Tickets" button. It bring up

Web page not available
The web page at intent://bandsintown.page.link/?link=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred&apn=com.bandsintown&amv=229&afl=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred&isi=471394851&ibi=com.bandsintown.bit&ius=bitcon&ifl=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred&imv=6.7&si=https://assets.prod.bandsintown.com/images/deferred-deeplink-image.png&utm_campaign=ticket&utm_medium=web&utm_source=jump_page&gclid=242&efr=1#Intent;package=com.google.android.gms;action=com.google.firebase.dynamiclinks.VIEW_DYNAMIC_LINK;scheme=https;S.browser_fallback_url=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred;end; could not be loaded because:

net::ERR_UNKNOWN_URL_SCHEME

I should also add that there are many links to concerts (all different ) on this site . and they change every month so it would be impossible to include these links as an intent in the manifest as I would have to change the app manifest every month.
Can anyone help me. Cheers, Michael
Hello,

The website link is using intent :
intent://

Do you want it to open a certain app ? because if you navigate the link without the intent:// it will redirect you to facebook

Edit :
I have created a sample app to test your website, what happens is once the user click on "TICKETS" it will redirect the user to another website :
https://www.bandsintown.com

Then it will be redirected again to : Facebook.com which will then open a facebook app to get the users information after that it will show a website :

I have never tried this before but am pretty sure that this approach is wrong, what you should do is redirect the clients to the final site which is :

without having to keep redirecting them over and over.

Thank you,
Saif
 
Last edited:
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Upvote 0

mikejohnsonharp

Member
Licensed User
Longtime User
The point of using the bandsintown website to list my concerts is, I only have to list them once at my membership to bandsintown and then I can have the concerts displayed on all of my websites, Facebook, mailchimp etc via website embedding.
The problem is when I list their website link to my concerts on on a WebView in the my android app, it doesn't follow all the links.
My suspicion is that adding chromeclient to the WebView might be the way to go. Can anyone suggest an example link to show what I should to to add this to webview within the forum. Michael
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Hey Mike,

In the post that I made the suggestion is a link to the code to add chromeclient, but I don't think it will work because I missed an important part of the error message you posted (but sfsameer caught it!)

And as sfsameer mentioned, the url includes "intent://" which is a deep link and not a simple URL, and he suggests a workaround.

You could still try my suggestion of adding chromeclient and maybe there's a change it might allow webview to better handle the deep-link properly.
 
Last edited:
Upvote 0

mikejohnsonharp

Member
Licensed User
Longtime User
Thanks John,
Will look at that. This is what I have on my app.

#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals


Dim WebView1 As WebView

End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("3")

WebView1.LoadUrl ("https://bnds.us/ytr0zq")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
StartActivity(Base)
End Sub
 
Upvote 0

mikejohnsonharp

Member
Licensed User
Longtime User
Can anyone show me how to get through this problem of having deep links with intent within the webview.

Maybe what I need is when I press a link within WebView, It will open the external default browser. Can anyone tell me how to do that???
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
If you try using webview to display the below URL, will it properly display the "tickets" page properly? (the below url is the url you posted in post #1 with the intent part removed)

https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred&apn=com.bandsintown&amv=229&afl=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred&isi=471394851&ibi=com.bandsintown.bit&ius=bitcon&ifl=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred&imv=6.7&si=https://assets.prod.bandsintown.com/images/deferred-deeplink-image.png&utm_campaign=ticket&utm_medium=web&utm_source=jump_page&gclid=242&efr=1#Intent;package=com.google.android.gms;action=com.google.firebase.dynamiclinks.VIEW_DYNAMIC_LINK;scheme=https;S.browser_fallback_url=https://www.bandsintown.com/t/102656774?app_id=art-12106794-ytr0zq&came_from=269&utm_medium=web&utm_source=jump_page&utm_campaign=ticket&affil_code=art-12106794-ytr0zq&deeplink=deferred

If so, then the solution might be to just remove the intent part of the URL by doing this:
B4X:
URL = URL.Replace("intent://bandsintown.page.link/?link=","")
And place that code in the "webview1_overrideurl" event of the webview so it will trim the intent part of a url if the user ever clicks on one with it.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
In the "webview1_overrideurl" event of the activity that has the webview in it.
 
Upvote 0

mikejohnsonharp

Member
Licensed User
Longtime User
Thanks John,
I put this on the WebView Page. It kind of works. It stops me going through the Ticket link but also all of the other links including RSVP and the Concert details.
Have I done something wrong in the Webview1_OverrideUrl section??
Michael

#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals


Dim WebView1 As WebView



End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("3")
WebView1.LoadUrl ("https://bnds.us/ytr0zq")


End Sub

Sub Webview1_OverrideUrl (Url As String) As Boolean
URL = URL.Replace("intent://bandsintown.page.link/?link=","")
' All Urls will not be loaded ...
Return True

End Sub


Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
StartActivity(Base)
End Sub
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Remove the Return True line because you want execution to continue so webview will navigate properly to the URL address clicked on:

B4X:
Sub Webview1_OverrideUrl (Url As String) As Boolean
    URL = URL.Replace("intent://bandsintown.page.link/?link=","")
    'Return True
End Sub

The Return True line tells webview that your code handled the URL, so webview doesn't need to navigate to it. By removing that line, webview will properly navigate to the URL the user clicked on when execution hits the End Sub
 
Last edited:
Upvote 0

mikejohnsonharp

Member
Licensed User
Longtime User
Hi Again John, I removed the Return True but it still gives me a
"net::ERR_UNKOWN_URL_SCHEME"
message.

I'm wondering if a viewer could browse the WebView1 and if the viewer chooses to press the "ticket" it could open the external Chrome browser.
in other words.....
would it be possible to use the "if" command... (Not sure of the correct syntax)
Sub Globals
Dim p As PhoneIntents
End Sub

Sub Webview1_OverrideUrl (Url As String) As Boolean
if URL = URL.Replace("intent://bandsintown.page.link/?link=","")

then StartActivity(p.OpenBrowser(""))
End Sub
???
 
Upvote 0

mikejohnsonharp

Member
Licensed User
Longtime User
Hello,

The website link is using intent :
intent://

Do you want it to open a certain app ? because if you navigate the link without the intent:// it will redirect you to facebook

Edit :
I have created a sample app to test your website, what happens is once the user click on "TICKETS" it will redirect the user to another website :
https://www.bandsintown.com

Then it will be redirected again to : Facebook.com which will then open a facebook app to get the users information after that it will show a website :

I have never tried this before but am pretty sure that this approach is wrong, what you should do is redirect the clients to the final site which is :

without having to keep redirecting them over and over.

Thank you,
Saif

Hi Saif,
I agree with you that the Bandsintown website has too much deep linking for a WebView to cope with. I spoke to Bandsintown and they are aware that this is a problem for people who want to use their personal link on bandsintown, by entering the concert touring information just once and having it displayed on their websites, facebook and their personal apps. But they want to track the "Ticket" button links and this seems to be the problem.
JohnC was suggesting using Webview1_OverrideUrl to strip the intent:// part from the url as below. Unfortunately it didn't stop the error message. Very Grateful for his help though.
ie...
Sub Webview1_OverrideUrl (Url As String) As Boolean
URL = URL.Replace("intent://bandsintown.page.link/?link=","")

End Sub

So I have abandoned that idea and thought is there a bit of code to bring up my personal concert link https://bnds.us/ytr0zq within the WebView and as soon as the user clicks the ticket link it could open the external default browser instead of the WebView. Maybe if the WebView detects there is an intent://
Thank in advance. Mike
 
Upvote 0

sfsameer

Well-Known Member
Licensed User
Longtime User
Hi Saif,
I agree with you that the Bandsintown website has too much deep linking for a WebView to cope with. I spoke to Bandsintown and they are aware that this is a problem for people who want to use their personal link on bandsintown, by entering the concert touring information just once and having it displayed on their websites, facebook and their personal apps. But they want to track the "Ticket" button links and this seems to be the problem.
JohnC was suggesting using Webview1_OverrideUrl to strip the intent:// part from the url as below. Unfortunately it didn't stop the error message. Very Grateful for his help though.
ie...
Sub Webview1_OverrideUrl (Url As String) As Boolean
URL = URL.Replace("intent://bandsintown.page.link/?link=","")

End Sub

So I have abandoned that idea and thought is there a bit of code to bring up my personal concert link https://bnds.us/ytr0zq within the WebView and as soon as the user clicks the ticket link it could open the external default browser instead of the WebView. Maybe if the WebView detects there is an intent://
Thank in advance. Mike
Hello,

You could simply use :
B4X:
Sub wv_OverrideUrl (Url As String) As Boolean
    Dim p As PhoneIntents
    If Url.Contains("intent") Then
        StartActivity(p.OpenBrowser(Url))
    End If
End Sub

But give me about an hour, we are trying a workaround and i will keep you updated.

Thank you,
Saif
 
Upvote 0

sfsameer

Well-Known Member
Licensed User
Longtime User
Hello,

Great News!

We did a very weird work around and it worked perfectly :)

Please download the attached project to see the solution.

*It needs more testing, so if you face any problem please do report it to us and we will help you right away.

Thank you,
Saif
 

Attachments

  • mikejohnsonharp.zip
    50.8 KB · Views: 187
Upvote 0

sfsameer

Well-Known Member
Licensed User
Longtime User
Hello,

BTW your website is not always running, there are a lot of down times 5/10 tries it works, so i think you need to talk to Bandsintown about the down times

1623937664787.png


Thank you,
Saif
 
Upvote 0

mikejohnsonharp

Member
Licensed User
Longtime User
You're a genius .It works.
But now the problem is the ticket processing on my website won't work within the webview and I don't this that Google would appreciate me not using their 'in-App purchases"
So I'm going to try this...
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals


Dim WebView1 As WebView



End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("3")
WebView1.LoadUrl ("https://michaeljohnson.com.au/mobile.php")


End Sub

Sub Webview1_OverrideUrl (Url As String) As Boolean
If Url.StartsWith("intent") Then
StartActivity(tickets)
End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
StartActivity(Base)
End Sub



and then the tickets activity will restart the link in the external browser
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals


Dim p As PhoneIntents
StartActivity(p.OpenBrowser("https://michaeljohnson.com.au/mobile.php"))
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


BTW the bandsintown people are trying to modify their code to accomodate the deep linking problem. So that why they keep dropping out. Nice of them. Thanks guys
 
Upvote 0
Top