Created
February 19, 2016 03:38
-
-
Save dbrant/f222e3b38d3757f6c2b1 to your computer and use it in GitHub Desktop.
Sketch of catching exception when WebView is being updated.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onStart() { | |
try { | |
super.onStart(); | |
} catch (Throwable t) { | |
if (ThrowableUtil.throwableContainsException(t, PackageManager.NameNotFoundException.class)) { | |
// This can happen when the system updates the WebView component. There's a | |
// brief window of time when the old WebView is uninstalled from the package | |
// manager, and the new one is not yet installed, so it literally doesn't exist. | |
// Comments from Chromium developers suggest that applications need to handle | |
// this themselves for now, until a better solution is developed in the framework. | |
// https://code.google.com/p/chromium/issues/detail?id=506369#c7 | |
//L.logRemoteErrorIfProd(t); | |
Toast.makeText(this, R.string.error_webview_updating, Toast.LENGTH_LONG).show(); | |
finish(); | |
} else { | |
throw t; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment