I have a code for a simple webview and while running the code works but shows an error 'caught security exception' in logcat. what does it mean?
WebActivity.java
public class WebActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web);
WebView mainWebView = (WebView) findViewById(R.id.mainWebView);
WebSettings webSettings = mainWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mainWebView.setWebViewClient(new MyCustomWebViewClient());
mainWebView.loadUrl("http://google.com");
mainWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
}
private class MyCustomWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
}
logcat
08-22 11:37:01.569: E/geolocationService(537): Caught security exception registering for location updates from system. This should only happen in DumpRenderTree.
最佳答案
您需要将其添加到您的 list 中。
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
关于android - 简单的 webview 示例捕获了安全异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18372931/