Android Question Webview and mailto: and social media

hibrid0

Active Member
Licensed User
Longtime User
Hi guys I like to know what the correct way to do this.

In a Webview I have some mailto, social media links and call link, I want to open this links outside my app.

Some of more info:
I want to wrap an web App maked with Ionic framework.
I make an apk with "cordova build android" and the app work so so, work offline yes, but a lot thing not work for example social media links, or map view.

I wrap the url online with a wrap hrml5 I found on the forum and work so so, the call us show an error and the social links etc show inside the app.

I wrap with files build in and show some errors.

I wrap with the httpserver and then show on webview with extras to connect to localhost and work fine, but with errors in call us and social media buttons.

I want a quick way to convert this "Web app" in Apk file.
And other idea why I want to wrap with b4a is I want to add push notifications for this wrap app.

I have online a version of what I want to wrap:


That only test files.
Tomorrow I upload the 3 versions I have.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
If you have control over the webpage you want to include in your app (say; if it is your webpage)) then you can use a javascriptinterface with the webview (search forum) and then you can put specials javascript calls into your website which then, when called/used, raise an event in your app and your app in return can do native calls inside these events
 
Last edited:
Upvote 0

hibrid0

Active Member
Licensed User
Longtime User
If you have control over the webpage you want to include in your app (say; if it is your webpage)) then you can use a javascriptinterface with the webview (search forum) and then you can put specials javascript calls into your website which then, when called/used, raise an event in your app and your app in return can do native calls inside these events
Wow Don you are a machine thanks.
I asked that because Chrome will open the call phone or open the social media app if I select the like of Facebook for example.

How can I do something like this without coding to the site?

But is the unique way I do that.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
A Google search suggests you just need to implement the 'OverrideUrl' callback and examine the protocol of the URL to be loaded.

If the protocol is 'tel:' or 'mailto:' then create an Intent based on the url and pass the Intent to StartActivity.
Return True from the OverrideUrl sub to indicate that you have handled the event.

Otherwise (for other protocols such as 'http:' and 'https:') simply return False from the OverrideUrl sub to indicate you have not handled the event and then the default behaviour will occur - the URL will be loaded in the WebView.

https://www.google.co.uk/search?q=android+webview+tel+and+mailto+links&ie=UTF-8&oe=UTF-8&gws_rd=ssl

http://stackoverflow.com/questions/9649334/android-webview-tel-geo-mailto-proper-handling

No need for a JavascriptInterface etc.
 
Upvote 0

hibrid0

Active Member
Licensed User
Longtime User
A Google search suggests you just need to implement the 'OverrideUrl' callback and examine the protocol of the URL to be loaded.

If the protocol is 'tel:' or 'mailto:' then create an Intent based on the url and pass the Intent to StartActivity.
Return True from the OverrideUrl sub to indicate that you have handled the event.

Otherwise (for other protocols such as 'http:' and 'https:') simply return False from the OverrideUrl sub to indicate you have not handled the event and then the default behaviour will occur - the URL will be loaded in the WebView.

https://www.google.co.uk/search?q=android webview tel and mailto links&ie=UTF-8&oe=UTF-8&gws_rd=ssl

http://stackoverflow.com/questions/9649334/android-webview-tel-geo-mailto-proper-handling

No need for a JavascriptInterface etc.


Hey thanks, yesterday I found a thread talking about that and you show the solution!
https://www.b4x.com/android/forum/t...rrideurl-event-with-my-webview-control.27583/
 
Upvote 0
Top