Is it possible to access the Internet from an Android 4.1 AVD emulator, running on a PC behind a firewall?
If I click on the Browser icon, I get an error saying "Webpage not available. Make sure you have a data connection."
If I click on the Maps icon, I get an error saying "Network failure. This application requires a working data connection."
If I try to add an Email account, I get an error saying "Couldn't open connection to server."
I have added -dns-server 10.xxx.xx.31,10.xxx.xx.32 -http-proxy http://10.xxx.xx.201:8080 (with correct IP addresses!) to emulator.exe command-line, but this does not seem to make any difference?
I can see the "3G" symbol next to a triangle at the top of the screen, and I can toggle it using [F8] key, but this does not seem to make any difference either.
Thanks for your help,
Best regards,
James
I have managed to RESOLVE this problem using the instructions below :-
Inside ADK emulator, goto Settings icon -> Wireless & Networks ->
Mobile networks -> Access Point Names
Press [F2] and select "New APN"
Name = James
APN = www
Proxy = 10.xxx.xx.201
Port = 8080
Username = xxxxxxxx
Password = xxxxxxxx
Press [F2] and select "Save"
Click "James" to set as default APN
Now goto Browser and you should be able to see homepage :)
Related
I'm using XAMPP and I wanted to see what the result is in my android phone locally so I did what is mentioned here and I got the result but because there is a problem in loading js, css, fonts and other public files I couldn't get what the original version is. I opened my browser in my phone and typed: 192.168.42.111 however I want to type mysite.local and get the correct result. BTW it doesn't show the page correctly in windows when I use localhost/mysite but mysite.local.
How can I connect to windows from android device just by typing mysite.local?
EDIT
I forgot to mention that I'm using my mobile network to connect to the internet and it is hot-spotted.
It's not possible to use Xampp from a hot-spot.Xampp is a local virtual server an you have to be in the same network.
If you are in the same network, then I would recommend to use the IPv4-Adress.
To get it do the following:
Press Win + R
Type cmd in the command field and click OK
Type in your cmd: ipconfig and press enter
Then you have to search a little bit after IPv4 in the cmd. If you have found it copy the adress and replace localhost (In your app you website) with it.
I have created simple listview apps using xamarin form and data are coming from webservices.
My current problem is , i couldnt connect internet my android emulator. Please anyone can guide how to do?
My Error image
Notes: My PC connected internet via LAN.
Connecting to the Internet from an Android emulator can be tricky.
One common issue is falling foul of a network proxy. If you have one on your network you need to configure it on the emulator.
Here is an article detailing Android emulator network settings.
You should check the connection settings of your emulator when you create one try creating one more emulator and revert us so we can help you create one.
The way i suggest you do it is use the emulators that visual studio provides check visual emulators in your respected search menu to find it .
One of the problems could be you do not have internet permissions which you can update in your manifest using this line:
<uses-permission android:name="android.permission.INTERNET" />
If this doesn't work follow the steps below :
1.Go to settings->Wireless & networks->mobile networks->Access Point Names.
2.Press menu button. an option menu will appear.
3.from the option menu select New APN.
4.Click on Name. provide name to apn say My APN.
5.Click on APN. Enter www.
6.Click on Proxy. enter your proxy server IP. you can get it from internet explorers internet options menu.
7.click on Port. enter port number in my case it was 8080. you can get it from internet explorers internet options menu.
8.Click on User-name. provide user-name in format domain\user-name. generally it is your systems login.
9.Click on password. provide your systems password.
10.press menu button again. an option menu will appear.
11.press save. try n run your browser. hope its work for you it worked for me. good luck.
For development I would like to use the calendar in an Android 4 emulator but the option "Calendars to display" is empty and I am not able to add an account with calendar.
I found several solutions but none of them worked:
m.google.com
Like adding account with m.google.com as server but it keeps telling me "You don't have permission to sync this server. Contact your server's administrator for more information." because it is disabled for new devices.
CalDAV
In the link above they are talking about using CalDAV but how without appstore? I installed the caldav4j apk to use CalDAV but it does not run. logcat tells me java.lang.NoClassDefFoundError: android.provider.Calendar$Events.
Add Google Account
If I add an normal Google account I can only select mail for sync, calendar is missing.
Android x86
Maybe I could avoid this problem by using Android x86 like suggested here as performance booster.
Got it working using AndroVM.
Download VirtualBox and an AndroVM image with gapps. Like androVM_vbox86p_4.1.1_r6.1-20130222-gapps-houdini-flash.ova. vbox86p is for phone and vbox86tp for a table with phone functions.
Follow the configuration tutorial: Import Virtual Machine, activate network
Start the VM and enter your gmail account during setup.
For debugging with eclipse: run AndroVM Config app (on mobile desktop) to get the IP and on the host: adb connect [IP]
Hareware keys: ESC = back, F1 = menu, Pos1 = home/unlock, End = lock
Btw: AndroVM is a speed rocked compared to the normal emulator.
I build a worklight application. create android app and test this application with local machine , its working fine with emulator.but when i try to test this application with android tablet it through error "The Application failed connecting to the service".
I try to find application-descriptor.xml and fix localhost to 192.168.1.1:8080
my ip local machine,but it not working.In my tablet I can't to go to 192.168.1.1:8080/console/index.html
Can anybody help me regarding this issue. how can i fix this one in my worklight android application and run it on my android tablet
Some things to check:
- Are your tablet and your worklight development machine on the same wireless network? (they need to be!)
- Does your computer have a firewall on it which may need configuring to let the traffic through. As a test you could briefly disable the firewall and see if you then have access (subject to disclaimer of the risk involved in disabling the firewall). A test without disabling the firewall would be to try accessing 192.168.1.1:8080 from another desktop/laptop machine on that same subnet.
Check ip in local machine ipconfig ( field Adaptador de Ethernet )
Set this IP in field host name configuration server.
Rebuild
The other test is to check the direction in other machine, in the same network.
In a command window, run ipconfig and copy the IPv4 address. This is the IP address you need to place as the value for worklightServerRootURL in the file application-descriptor.xml.
The IP address you are usingnow does not look to me like the correct (public) IP address that you need to use. Try my above suggestion.
How about adding "192.168.181.1:8080" in application-descriptor.xml?
I would suggest the following debugging steps:
a) Go to your device browser and browse to http:
//xx.xx.xx.xx:8080/console
-> If this doesn't work, you have an obvious ip address issue. Then you have to figure out why, maybe you have a Symantec thingy that blocks any incoming traffic to your desktop - which they do. You should do an explicit allow.
b) If a) works, then you need to check in your code to make sure your app does try to connect to the server at startup. Or else the app will only try to connect when it calls adapter.
Now, go to your code. open the initOptions.js file. I typically, would set connectOnStartup to true, but also enable the onConnectionFailure so that it runs offline when there is no connection.
var wlInitOptions = {
// # Should application automatically attempt to connect to Worklight Server on application start up
// # The default value is true, we are overriding it to false here.
connectOnStartup : true,
// # The callback function to invoke in case application fails to connect to Worklight Server
onConnectionFailure: function (){wlCommonInit();},
// # Worklight server connection timeout
timeout: 2000,
};
3) Make sure you have the right URL in the application-descriptor.xml
<worklightServerRootURL>http://xx.xx.xx.xx:8080
</worklightServerRootURL>
If you are using the consumer edition (the real purchased WL), your URL would be.
<worklightServerRootURL>http://xx.xx.xx.xx:9080/worklight
</worklightServerRootURL>
(Note no space in between those URL - it's just this website putting a space there when there is a line break)
Redeploy your code to the WL server and create a new APK file. Update your device with the new APK file.
4) Do a test with the console again, you should see the console. Click on the Preview app link, it should work.
5) Now that you have updated your code on the server and the APK file. Open it up again on the device.
Do you still see the error message?
If things still not work.
6) Go to the app setting, since you have enable offline mode, it would allow you to access the App settings (it's the 4th button in Android) Go to Worklight Settings. Select Server Address -> Add the worklight URL to the Server URL. When you go back to the app, this will automatically reload the content from your WL server.
I know that I have to edit the /system/etc/hosts to map an IP address to a host name, but it seems that I can't edit the file. Is it because my android phone is not rooted?
Kindly advise. Thanks.
You can use the following guide and application to setup rules for specific domains.
Download (Daedalus) and open the application.
Click on the menu then click “Servers”
Click the add button and add the two google servers “8.8.8.8” and “8.8.4.4”, You can substitute these for your preferred DNS provider as well.
Activate these dns servers in the menu by clicking on “Settings”
Then select Google and Google 2 from the settings. Also activate Advance settings and select the two following options in the image below
Back to the menu now, Click on “Rules”.
Add a new rule for each development mode, Live, staging, dev. Filename is not crucial, just make something up.
Hit sync rule before leaving to make sure the file is downloaded.
Tap and activate the mode you wish to be in, You can activate more than one at a time so be careful as this will override one or the other.
In the menu go to home, and hit the “Activate” button.
Source: https://silocitylabs.com/post/2018/03/02/changing-dns-settings-for-android-development/
Try to remount using adb and edit the file
Why do you need to edit the hosts file?
You can simply add your host to a local DNS (e.g. the DNS announced by a local DHCP-Server in your Wifi-Network) or even in the real global DNS.