Question

The situation I have now is that I have an app built with webview which is pointing to my website. I never had any file for user to download on my site, so I never take care of onDownloadStart. here comes an issue when I recently upload a file to my site and let user to download it. Users are not able to download the file if they are inside of the app. I can however set the downloadlistsner but people with older version are hopeless. I then came up with an idea to send user to chrome. but throwing out an intent for chrome to catch isn't available yet in the app with older version. the only place I can make this happen is update my site. Is it possible that I can do something like chrome://url=blahblah and have chrome to take care of the url? or is there any better way to solve this issue?

Thanks guys

Was it helpful?

Solution

You could use the intent: scheme, and specify the Chrome activity as the target, however this will only work if the user has Chrome installed.

Also, whether this works or not depends how you implemented WebViewClient.shouldOverrideUrlLoading:

  • if you didn't set a WebViewClient at all, then it's fine,
  • otherwise you would need code in shouldOverrideUrlLoading that would create an Intent (something similar to this).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top