Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simple webview example caught security exception

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.
like image 391
user2681154 Avatar asked Jan 30 '26 10:01

user2681154


1 Answers

You need to add this in your manifest.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
like image 93
Piyush Avatar answered Feb 02 '26 03:02

Piyush



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!