简体   繁体   English

WebView 不使用 INTE.NET 权限集

[英]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我有一个非常简单的应用程序,我无法让 WebView 显示 google.com(这就是我用来测试的

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 :这是我在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 WebView 显示Web 页面不可用但 LogCat 上没有错误或消息

What am I missing?我错过了什么?

I'm testing this on my device not the emulator.我在我的设备上测试这个而不是模拟器。

www.google.com is not a url, but http://www.google.com is. www.google.com不是 url,但http://www.google.com是。 Fix your loadUrl() call to hold a proper url and it should work (if you have a valid connection, etc.).修复您的 loadUrl() 调用以保持正确的 url 并且它应该可以工作(如果您有有效的连接等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM