How to access the internet with an Emulator simulating Android Tablet without GSM

别说谁变了你拦得住时间么 提交于 2019-12-14 02:27:31

问题


I'm trying to test an application that has on the Manifest:

<uses-feature android:name="android.hardware.telephony" android:required="false" /> 
<uses-permission android:name="android.permission.CALL_PHONE" />

This was done to support Tablets without GSM capabilities.

The problem is... I don't have a physical device to test, and I need to access the internet from the app. Whenever I create a emulator without GSM support... I cannot access the internet.

Does anybody have a clue on how to access the internet from the Android emulator when it doesn't have GSM support?

The documentation that I read said that there is no WiFi support on the emulator, so.. is there anyway to use another thing?

UPDATE:

This question might help others with the same problem: How to disable/enable network, switch to Wifi in Android emulator?


回答1:


Have you looked at the Android-x86 project, it has wi-fi support so it will be able to do what you need. This screenshot shows wifi working.

I know it isn't exactly what your looking for, but as far as I'm aware you're correct in thinking that wi-fi support is not possible on the default emulator.




回答2:


The wifi initialization on emulator must be modified to do what you want. The idea is to trick to emulator wifi initialization phase and provide it a handmade list of wifi networks. For debugging purposes, I guess it's ok...

Someone did that here (code sample included) : http://kmansoft.com/2010/07/27/debugging-wifi-in-the-emulator/




回答3:


Maybe these point are trivial, but I would check:

  1. Had you defined the <uses-permission android:name="android.permission.INTERNET"/> inside the <manifest> tag, but outside of the <application> tag?
  2. Don't forget, that what you put in manifest, describes your application, not emulator. (your question makes me think that you have an error in understanding it)

Edit: Ok, now I see.

Is there only one emulator out there? What about using different IDE with different emulator?




回答4:


If you want to access internet on your emulator then. Please have a look on this. It should be help for you.

First thing you have to set adb path(i.e. plateform tools and tools) then fire the following command on command prompt.

syntax: emulator.exe -avd avd_name -scale scale_size -dns-server 8.8.8.8

exa.

emulator.exe -avd avd2.2 -scale 0.7 -dns-server 8.8.8.8




回答5:


I think you should be able to do that

more here




回答6:


1) In which OS u r working? 2) U can access internet in emulator if ur system have wired net connection. I am using
Environment/Platform : Linux/Eclipse, Android SDK By adding in the manifest. with wired connection.

Read this post :1) How to set Internet options for Android emulator? 2) http://code.google.com/p/0xdroid/issues/detail?id=3 3) http://i-miss-erin.blogspot.com/2009/09/android-emulator-external-gsm-modem.html

Although it may be not use-full for u as u r using it Without GSm enabled, I tested those condition in a e-pad, got the net connection from wifi.



来源:https://stackoverflow.com/questions/8824352/how-to-access-the-internet-with-an-emulator-simulating-android-tablet-without-gs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!