Android Question WebView do not allow URLScheme? net::ERR_UNKOWN_URL_SCHEME

IamTrying

Active Member
Licensed User
WebView is unable to trigger URLScheme?

Code:
Sub FinishDownload
    Log(">>> FinishDownload")
    'Activity.RemoveAllViews
    'Activity.LoadLayout("2")  
    WebView1.LoadHtml("<html><script>function SMS(){window.location.href='sms:0012127773456';}</script><body onload=SMS(); > or click <a href='sms:0012127773456'>SMS</a></body></html>")
    'WebViewExtras1.addWebChromeClient(WebView1, "")
End Sub

ERR_UNKNOWN_URL_SCHEME.png
 
Seems that there is no app installed on your device which has registered the scheme sms://
I´m wondering why you want to send a sms from a webview if you already have ALL YOU NEED in the Phone lib of b4a...

Code:
Dim Sms1 As PhoneSms
Sms1.Send(phone number,"hello")
 
Upvote 0
I have my own Java apps and other third party SDK's. who needs the URLScheme trigger.

LAbaYv2.png

EDIT: phone library was included but still same.
 
Upvote 0
Thats Scripting - Won't work in pure WebView
 
Upvote 0
Let me clear the confusion.

1. i have primary Java app with third party SDK's (to do audio/video/presentation/logmein etc etc)
2. I need secondary app to trigger URLScheme to my primary APP. (not only SMS service to use)

If i am not wrong. In past it worked with Cordova even. Not sure how to do it in B4A.
 
Upvote 0
2. I need secondary app to trigger URLScheme to my primary APP. (not only SMS service to use)
You are free to define a new scheme (and your app responsible for this scheme)... Like myscheme://blabla
Any link with the scheme myscheme:// will be starting your app. You app need to read the parameters and parse them...
 
Upvote 0
Code:
AddActivityText(Main,
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "beka://service” -->
<data android:scheme="beka" android:host="service" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "beka://kunden” -->
<data android:scheme="beka" android:host="kunden" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "beka://ab” -->
<data android:scheme="beka" android:host="ab" />
</intent-filter>
)

this manifestchange will make the app responsible for the following urls

- beka://kunden/
- beka://service/
- beka://ab/

Link to a sample-project (in the german forum)

PD: Bill; check the sample... This will work using a B4A Webview too :D
 
Upvote 0
You are free to define a new scheme (and your app responsible for this scheme)... Like myscheme://blabla
Any link with the scheme myscheme:// will be starting your app. You app need to read the parameters and parse them...
See this examples.

Compile and install serviceapp first. It registers the schemes...
Quit the app
Compile and run wvapp. A wv with a html page from assets is shown. Click on any of the links to open the service app
 

Attachments

Upvote 0
Its working.

[Exception]: FYI

- when i use your sample (works). But when i use your "wvapp.zip" to trigger mine/third party SDK apps similar way, then it still fail like before
- To execute my/third party (closed source) SDK.
when i use following RAW method (without using WebView, WebViewExtra) it do work too

Code:
Sub callPrimaryApp
    Dim Intent1 As Intent
    ' works : "closedsourcesdk://arg0_arg1_arg2/"
    ' works : "closedsourcesdk://arg0_arg1_arg2"
    Intent1.Initialize(Intent1.ACTION_VIEW, "closedsourcesdk://arg0_arg1_arg2")
    StartActivity(Intent1)
End Sub
 
Upvote 0
The problem seems to be in the scheme parts.
Compare it to real URLs to a domain giving some vars.

For example

Register a scheme
"closedsource"
which is responsible for the domain "sdk".

You then can handle all links to "closedsource://sdk/*

For ex:
closedsource://sdk/arg0/arg1/arg

The app reacts on closedsource://sdk
Everything from the Query (in this case /arg0/arg1/arg) you need to parse yourself. BUT you can use as many parameters you want. You just need to be able to parse it in the main app....
 
Upvote 0
Something like a few iBeacons ? (On their way by the way - send you the detail later)
This is my last try to contact you...

I´ll answer here as you are not responding to my private Messages since weeks :-(

Any news on this? Or did i upset you somehow?
 
Upvote 0
Back
Top