Comments (5)
I have found a workaround.
I created a custom WebViewListener
that - upon receiving an error - navigates the user to a custom error screen:
class CustomListener(private val activity: WebPortalActivity): WebViewListener() {
private var hasHandledError = false
override fun onReceivedError(webView: WebView?) {
super.onReceivedError(webView)
// This conditional check prevents multiple errors from triggering multiple navigations
if (!hasHandledError) {
hasHandledError = true
val intent = Intent(activity, WebViewErrorActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
activity.startActivity(intent)
}
}
}
The custom error screen basically says that something went wrong and it provides a "Return home" button. Tapping the button will navigate the user to a new Bridge Activity, giving them a fresh start without needing to kill the app. If the original issue persists (e.g. they still lack a data connect), the resulting error will simply navigate them back to our custom error screen.
Unfortunately, we cannot give the user any meaningful message about what went wrong because the WebViewListener
does not pass the error forward. That's fine for our immediate use case, but I think it would be polite to provide an error in the onReceivedError
function of WebViewListener
.
from capacitor.
Related Issues (20)
- [Bug]: @capacitor/google-maps "Error calling method create on plugin CapacitorGoogleMaps: No method found." on iOS HOT 11
- Creating a Cross-Platform Library with Capacitor for Android and iOS Integration HOT 2
- [Feature]: how to do ssl pinning? HOT 4
- [Feature]: How to output logs HOT 2
- [Bug]: was capacitor team has decrease develops or got a layoff in past,seems alot of bugs not have a good resolve,just close it via bot HOT 7
- WSL - ERR_EMULATOR_HOME_NOT_FOUND: No valid Android Emulator home found HOT 3
- [Bug]: Error Registering Plugins HOT 4
- [Bug]: QR code parse error, error = R: No MultiFormat Readers were able to detect the code. HOT 2
- [Feature]: Error Handling with nonexistent files and @capacitor/filesystem HOT 1
- [Feature]: Change JSObject from "is" to "has" to allow type security for those who want it
- [Bug]: JS does not get injected into DOM if appUrl contains query parameter HOT 3
- [Bug]: HOT 4
- [Bug]: Percent-encoding of url search parameters broken for patched fetch / xhr requests through CapacitorHttp HOT 1
- [Feature]: Add geolocation EXIF data to images captured with the camera HOT 5
- [Bug]: multipart/form-data values are not encoded on Android HOT 1
- [Feature]: "AppLeave" Event HOT 4
- [Bug]: @capacitor/google-maps "Error calling method create on plugin CapacitorGoogleMaps: No method found." on iOS HOT 4
- [Bug]: FormData not working when CapacitorHttp is enabled HOT 3
- [Bug]: All plugins return "Not implemented" only on ios HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capacitor.