user2681154
user2681154

Reputation: 97

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.

Upvotes: 3

Views: 2974

Answers (2)

joseAndresGomezTovar
joseAndresGomezTovar

Reputation: 819

This link has the key http://cordova.apache.org/docs/en/2.5.0/cordova_device_device.md.html

I am developing with Android - Phonegap

I added

--> app/res/xml/config.xml

< plugin name="Device" value="org.apache.cordova.Device" />

--> app/AndroidManifest.xml

< uses-permission android:name="android.permission.READ_PHONE_STATE" />

and works fine

PS: maybe it's the same answer of this one Using navigator.geolocation.getCurrentPosition in WebView on Android 2.0+ (PhoneGap related)

Upvotes: 0

Piyush
Piyush

Reputation: 18933

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" />

Upvotes: 3

Related Questions