android WebView internet access problem, because of proxy?
Here is my problem:
Emulator(Android 2.2) is able to access internet through browser. (I am behind a proxy so i set the proxy first)
but when i create a webview app, seems like it can not access the internet by web开发者_开发百科view.
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
is set up. So I am afraid it's because of the proxy.
Any clue ? Thanks.
Try adding In OnCreate()
WebView.enablePlatformNotifications();
And adding the following permissions to the manifest
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
This should enable your webview to access the proxy info it needs. You may need to restart your emulator (hopefully not).
For me, my apps cannot access webViews unless I specify a DNS server for my Android simulators. This is how I solve the issue in eclipse:
- Eclipse > Preferences > Android > Launch:
- Default emulator options:
- dns-server 8.8.8.8
You must also add "-dns-server 8.8.8.8" for any Android Run Configurations already created.
- Run > Run Configurations > Select Android Project > Target Tab > Additional Emulator Command Line Options:
- Add "-dns-server 8.8.8.8" here.
Not sure if this will help with your issue, but hopefully it does.
精彩评论