Skip to content

Commit

Permalink
enable LocalStorage access in WebView to allow JWPlayer 7+ to load
Browse files Browse the repository at this point in the history
  • Loading branch information
warren-bank committed Jun 4, 2019
1 parent ed3fd49 commit cfde00b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,28 @@
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import com.google.android.material.snackbar.Snackbar;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebStorage;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.snackbar.Snackbar;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
Expand Down Expand Up @@ -245,6 +247,16 @@ public void onDestroy() {

webView.clearCache(true);
webView.clearHistory();
webView.clearFormData();
webView.clearSslPreferences();
WebStorage.getInstance().deleteAllData();
if (Build.VERSION.SDK_INT >= 21) {
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().flush();
}
else {
CookieManager.getInstance().removeAllCookie();
}
}

// ---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -825,6 +837,7 @@ public void onReceivedError(WebView view, WebResourceRequest request, WebResourc
webSettings.setDisplayZoomControls(true);
webSettings.setUseWideViewPort(false);
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setUserAgentString(
getResources().getString(R.string.user_agent)
);
Expand Down
6 changes: 3 additions & 3 deletions constants.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
project.ext {
releaseVersionCode = 004070316
releaseVersion = '004.07.03-16API'
releaseVersionCode = 004070416
releaseVersion = '004.07.04-16API'
minSdkVersion = 16
targetSdkVersion = 28
compileSdkVersion = 28
buildToolsVersion = '28.0.3'
jetpackVersion = '1.0.0'
javaVersion = JavaVersion.VERSION_1_8
jetpackVersion = '1.0.0'
exoPlayerVersion = '2.10.0'
}

0 comments on commit cfde00b

Please sign in to comment.