3

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.
1
  • have you also check network state for this? Commented Aug 22, 2013 at 6:26

2 Answers 2

3

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" />
Sign up to request clarification or add additional context in comments.

Comments

0

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.