Claxxess
Claxxess

Reputation: 33

android.permission.INTERNET not working

So according to the android api all you have to do is add the permission.INTERNET in the manifest to allow an app to connect to the internet. I have done this and it still doesn't work. I post the manifest here, if anyone can give any insight into why this could be I would be very greatful.

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

        <uses-sdk
            android:minSdkVersion="8"/>
        <uses-permission android:name="android.permission.INTERNET"/>


        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme">
            <activity

                android:name="com.example.psat.ProsperitasSAT"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    </manifest>

Here is the part that handles the logic of the webpage fetching:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_prosperitas_sat);
    ((WebView) findViewById(R.id.dataWindow)).getSettings().setJavaScriptEnabled(true);
    ((WebView) findViewById(R.id.dataWindow)).loadUrl("www.google.com");
}

Upvotes: 3

Views: 3786

Answers (2)

petey
petey

Reputation: 17150

You will need the "http://" of the url:

((WebView) findViewById(R.id.dataWindow)).loadUrl("http://www.google.com");

Upvotes: 3

Slugshead
Slugshead

Reputation: 55

Try adding both.

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

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

Upvotes: 2

Related Questions