Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import android.content.Context;
- import android.os.Build;
- import com.piggybank.framework.tools.Guard;
- import com.piggybank.framework.tools.OsUtils;
- /*
- Created by GeneralGDA on 24.09.2015.
- */
- public final class WebViewUtils
- {
- private static final String WEB_VIEW_DATABASE_FILE = "webview.db";
- private WebViewUtils()
- {
- throw new UnsupportedOperationException();
- }
- public static boolean isWebViewCorrupted(final Context context)
- {
- Guard.nonNullArgument(context, "context");
- try
- {
- final int currentSdk = Build.VERSION.SDK_INT;
- if (currentSdk <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
- {
- try
- {
- context.openOrCreateDatabase(WEB_VIEW_DATABASE_FILE, 0, null).close();
- }
- catch (final Throwable e)
- {
- // try again by deleting the old db and create a new one
- context.deleteDatabase(WEB_VIEW_DATABASE_FILE);
- context.openOrCreateDatabase(WEB_VIEW_DATABASE_FILE, 0, null).close();
- }
- }
- return false;
- }
- catch (final Throwable ignored)
- {
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement