mgks / Android-SmartWebView

A simple use webview integrated w/ native features to help create most advanced hybrid applications.
https://mgks.dev/smart-webview
MIT License
552 stars 276 forks source link

Whatsapp application are not showing up #85

Open riyazahmad97 opened 5 years ago

riyazahmad97 commented 5 years ago

Describe the bug A clear and concise description of what the bug is, better if you can attach a log.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Device (please complete the following information):

Additional context Add any other context about the problem here.

riyazahmad97 commented 5 years ago

Hi,

In my application, i have allowed user to share via whatsapp, facebook and twitter. When i click on share with facebook, it jumps to the browser look facebook and not the facebook application in my mobile. The same thing happen for twitter. But for whatsapp, it jumps to error.html.

Here's my code.

HTML Code: <a href="whatsapp://send?text=HERE GOES THE URL ENCODED TEXT YOU WANT TO SHARE" data-action="share/whatsapp/share"> <i class="fa fa-whatsapp whatsapp-color"></i> Whatsapp </a>

Java file (SmartWebView.java):

` //Permission variables

static boolean ASWP_JSCRIPT     = true;     //enable JavaScript for webview
static boolean ASWP_FUPLOAD     = true;     //upload file from webview
static boolean ASWP_CAMUPLOAD   = true;     //enable upload from camera for photos
static boolean ASWP_ONLYCAM     = false;    //incase you want only camera files to upload
static boolean ASWP_MULFILE     = false;    //upload multiple files in webview
static boolean ASWP_LOCATION    = true;     //track GPS locations
static boolean ASWP_RATINGS     = true;     //show ratings dialog; auto configured, edit method get_rating() for customizations
static boolean ASWP_PBAR        = false;    //show progress bar in app
static boolean ASWP_ZOOM        = false;    //zoom control for webpages view
static boolean ASWP_SFORM       = false;    //save form cache and auto-fill information
static boolean ASWP_OFFLINE     = false;    //whether the loading webpages are offline or online
static boolean ASWP_EXTURL      = false;     //open external url with default browser instead of app webview`

Hope to get response from you. Thanks.

mgks commented 5 years ago

You are providing a custom protocol to the system, i.e, whatsapp://. Webview doesn't know if you're asking for an app so it is handling it as a basic web protocol, which it isn't and throws error.

You need to specify in the program how you want to handle a specific protocol or open apps on certain link redirects.

riyazahmad97 commented 5 years ago

okay thanks @mgks for your reply.

i have seen https://stackoverflow.com/questions/35316854/webview-on-android-whatsapp-share. Im still new in android web view, do you know where should i paste the code?

Thanks for your time.