From ae096b2c9cfcda59ae65c8afea81df5284d7177f Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 4 Sep 2024 12:50:12 -0400 Subject: [PATCH] Try harder to make webview localStorage work on different versions. I suspect that's what #73 is about. --- .../unprompted/tildefriends/TildeFriendsActivity.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java b/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java index be8d0a8f..90bfab61 100644 --- a/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java +++ b/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java @@ -165,6 +165,8 @@ public class TildeFriendsActivity extends Activity { web_view.getSettings().setDatabaseEnabled(true); web_view.getSettings().setDomStorageEnabled(true); + set_database_path(); + web_view.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String content_disposition, String mime_type, long content_length) { Log.w("tildefriends", "Let's download: " + url + " (" + content_disposition + ")"); @@ -458,4 +460,12 @@ public class TildeFriendsActivity extends Activity { s_activity.service_connection = null; } } + + @SuppressWarnings("deprecation") + private void set_database_path() + { + if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) { + web_view.getSettings().setDatabasePath(getDatabasePath("webview").getPath()); + } + } }