I know that this question is ask many times in stackoverflow, but their solution is didnt work for me. Thats why I am asking this question.
Now the question is that I am developing an app by android webview, now this app is working perfect in older version of android version but didnt working in latest android version i.e. 9
I tried many things from other solution like
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
added this code in onCreate method but didnt work.
Another I try is add the @xml/network-security-config file but this also didnt work.
Here is my network-security-config code
<?xml version ="1.0" encoding ="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain>onlineawaz.in</domain>
</domain-config>
</network-security-config>
public class MainActivity extends AppCompatActivity {
WebView webView;
ProgressBar bar;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = (WebView) findViewById(R.id.webView2);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
bar =(ProgressBar) findViewById(R.id.progressBar2);
webView.loadUrl("http://onlineawaz.in/");
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new myWebClient());
}
public class myWebClient extends WebViewClient{
//page event
}
}