SERPRO
SERPRO

Reputation: 10067

WebView not working with INTERNET permission set

I have a very simple application and I cannot make the WebView to show google.com (That's what I'm using to test

this is my Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bantol.mpp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".MPPActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver android:name=".SMSReceiver" >
            <intent-filter android:priority="100" >
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

this is the code I'm using in my MPPActivity:

    @Override
    public void onResume()
    {
        super.onResume();
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) 
            {
                return true;
            }
        });
        mWebView.loadUrl("www.google.com");
    }

The WebView shows Web page not available but no errors or messages on the LogCat

What am I missing?

I'm testing this on my device not the emulator.

Upvotes: 1

Views: 2138

Answers (1)

mah
mah

Reputation: 39807

www.google.com is not a url, but http://www.google.com is. Fix your loadUrl() call to hold a proper url and it should work (if you have a valid connection, etc.).

Upvotes: 3

Related Questions