"intent://" scheme in DS WebView

1,770 views
Skip to first unread message

Regis Silva

unread,
Feb 1, 2017, 3:11:33 PM2/1/17
to DroidScript

Guys,

when I try to open the following URL in Android Chrome it opens with success the "mysite.com" in the scheme.


but when I try to do the same with DS WebView using LoadUrl  (or even customizing an <anchor> to do that after rendering the link) the WebView gives me an error net::ERR_UNKNOWN_URL_SCHEME

Its very special thing because with this "intent://" scheme I found that I can launch, whatsap, telegram, wechat (and others) passing parameters and getting message system work indirectly. BUT only using Android Chrome because in DS WebView I just get this error message always.

Does it make any sense for anybody?

Thanks. :D





Steve Garman

unread,
Feb 1, 2017, 3:28:01 PM2/1/17
to DroidScript
Have you tried using app.SendIntent ?
Message has been deleted

Regis Silva

unread,
Feb 1, 2017, 3:50:59 PM2/1/17
to DroidScript
Steve,

 problem is I am not sure what should be the correct parameters to pass to app.SendIntent() in order to open Chrome with the url "mysite.com?p1=X&p2=Y".

 Maybe it would be those bellow but it does not work for me in my "experiments"...

pck = "com.android.chrome",
cls = "com.whatsapp.Main",
act = "Intent.ACTION_VIEW",
cat = null, (???)
uri = "mysite.com"  (????)
typ = "plain/text", (???)

extras = [{   name: "android.intent.extra.TEXT",
 type: "string",
value: "p1=X&p2=Y"
} ];   (???)

It is so so more easy to use the URL scheme as I showed in the first post that I just had quit to discover the SendIntent parameters...

To be hones, until now I did not see anyone (here in forum or outside) that could really show a piece of code that work with WhatsApp and Chrome intents, only simple things like email, contact, etc..    I dont judge because I could not did it either, but I am just trying to workaround with these new 'scheme' tips that actually are working perfectly in Android Chrome but not working in DS WebView only unfortunally.

Any clue from your side would be really precious as long I do respect you as a guru man. :D

Thanks in advance !

Dave Smart

unread,
Feb 1, 2017, 4:10:03 PM2/1/17
to androi...@googlegroups.com
If you just want to open a URL from a webview you just need to do this in your HTML page:- 

app.OpenUrl(  "http://myurl.com" )

Don't forget to include app.js at the top of your HTML file like this:-

<script src='file:///android_asset/app.js'></script>

(it will open in the Android Chrome browser)

Regis Silva

unread,
Feb 1, 2017, 4:22:37 PM2/1/17
to DroidScript


Life would be so hard without you DS Team Guru Guys!  :D

It worked like a charm !

Dave, thank you a lot!  And thanks Steve for the initial support also!

:D

kalmen chia

unread,
Jul 24, 2017, 11:50:34 PM7/24/17
to DroidScript
Hi ,

app.OpenUrl("www.google.com");  will it possible to get the browser to open in full screen ? 
no title bar , no footer ...
i.e. @android:style/Theme.NoTitleBar.Fullscreen

or is there any method, where we can achieve it ? i am running a webserver using vue.js and are finding out
ways of possibility to loading the "http://localhost:8080/index.html" .

FYI, i have tried 
  web = app.CreateWebView( 1, 1 );
  ...
  web.LoadUrl( uri );

have no luck , it has error , saying ... _run() not found , conflicts with vue.js.
all i wish to achieve is that , it will openup a full screen webview which loads a html serve by the webserver.
thanks,
Kalmen



Steve Garman

unread,
Jul 25, 2017, 4:40:42 AM7/25/17
to DroidScript
You cannot do it with OpenUrl.

Have you tried
web = app.CreateWebView( 1, 1, "ignoreErrors" );

Please post a screenshot of the error message. Have you capitalised it correctly in your post?

kalmen chia

unread,
Jul 25, 2017, 5:17:11 AM7/25/17
to DroidScript
Hi Steve,

the Error dialog is Script Error : _Run is not defined
Source : ... nothing .....

and the debug screen shown ,
  • Wbs.Start( )
  • WARNING: Wbs.Start() failed! (bind failed: EADDRINUSE (Address already in use))
  • Started web server
  • App.GetIPAddress( )
  • -> 192.168.100.161
and my code is as follow :

                methods: {
                    openWebViewPage(){
                            
                            lay = app.CreateLayout( "linear", "VCenter,FillXY" );
                                    
                            web = app.CreateWebView( 1, 1 ,"ignoreErrors" );
                            web.SetOnProgress( web_OnProgess );
                            lay.AddChild( web );
                        
                            app.AddLayout( lay );
                            //
                            app.ShowProgress("Loading...");
                            //var uri = "http://"+"localhost"+":8080/index.html";
                            var uri = "http://www.google.com";
                            web.LoadUrl( uri );
                            
                            //if i disable the above code and using the below, it works .                          
                            //app.OpenUrl(  "http://localhost:8080/index.html" );                    
                        
                    },


it is when i called it at my html , as i said , this is a page where i used vue.js , so you can see the v-on:click , the page actually
came out but already crashed , when i click the OK button at the dialog, it will close the application ,

<body onload="app.Start()">

<header>
    <div class="btn-menu"><a href="" v-on:click="openWebViewPage()"><img src="Html/menu-button.png"/></a></div>
    <h1>APPLICATION MAIN PAGE</h1>
</header>

thanks for helping ,
kalmen.


Reply all
Reply to author
Forward
0 new messages