Pages

Sunday 3 June 2012

AndroidWifi

To read the update messages on this guide click here
 
A few months back, I bought an android phone. I found android was way better than iOS, except for one little issue, which I was fortunate enough to get around. I have always been sharing my internet connection with my phone, be it an iPhone, iPad or any other device. They all worked pretty well with my windows Ad-hoc connection sharing. Except for this phone which is really a major disadvantage.

A lot of people use connectify to get around this on windows 7. For me, as it has always been, I wanted something simple and fast. I did some search, and found out an easy way of making a virtual router. This involved using command line to give commands for enabling virtual wifi, so it was easy for me to write a batch script which did all the work for me. Its pretty much same as connectify, but way faster and simpler, plus instead of using that 'advertising' SSID in connectify, you can choose your own SSID name with this method. I have divided the setup into few simple steps, so everyone can understand easily.

Settings on your phone

While I was trying to make a virtual router on my laptop I could connect successfully but after a while the phone had problem browsing, connecting or even discovering the virtual router. I started troubleshooting, and found out that the problem was not with the virtual router, but it was in the phone settings. My android phone used network based location services which, whenever the phone connected, tried finding the location using the network. It was this service which made the wifi connection impossible. I disabled this and it started working as a charm. To disable this service on Nexus S (Ice Cream Sandwich), go to Settings->Location Services and disable all services as shown below.


Disabling these options will be similar in other android phones as well. Just look for Location options in settings, and you will get there.

Settings on your pc
 
UPDATE (21/07/2012): I have written an application for doing this step. 
Here is the link: AndroidWifi is live!
If you use this application then this step can be skipped. 

I have written this guide using Windows 7, however similar method can be used on Windows Vista. To start with settings on your pc, first thing you have to do is make a batch file. To do this open a new notepad window and copy the following lines.
netsh wlan set hostednetwork mode=allow ssid=MySsid key=MyPassword keyUsage=persistent 
netsh wlan start hostednetwork
Replace MySsid with the SSID name you want, and MyPassword with your own password. Save this file as TurnWirelessOn.bat, and make sure the extension is .bat.

As you might have already guessed this batch file will be used to turn on the wireless connection. We need one more batch file to turn off the virtual router. To do this follow the same procedure as above replacing the commands with the following commands.
netsh wlan stop hostednetwork
 Name this file as TurnWirelessOff.bat for simplicity.












Sharing your connection
Now comes the tricky part. You have to run the above batch file, which will first create a virtual wireless connection. After it has been created, you can use it to share your LAN connection to. To do this, right click  on TurnWirelessOn.bat file and select run as administrator.



 This will enable an internet connection with the SSID and password you provided. Now go to Network and Sharing Center->Change Adapter Settings. You will notice two wireless connections, as shown below:






Note down the name of the wireless connection which uses Microsoft Virtual Wifi Miniport. In this case it is called Wireless Network Connection 2.

Now right click and open properties of Local Area Connection. Go to Sharing and enable  connection sharing and choose Wireless Network Connection 2.




Once you apply the settings, you might get a notification that the connection is currently active. This can be fixed by TurnWirelessOff.bat. Opening this file as administrator will turn the connection off, enabling you to set the sharing options.

Once everything is set up, just use the two batch scripts to share your internet connection to your android, and enjoy!

Update (07/07/2012):  As I can not try this method on different version of windows, with different models and android version, therefore I request everyone to please leave a comment with windows version, mobile model, type of internet shared and android version

If it is working great for you, why not share it with others. It will just cost you a simple LIKE at alternativeto page for this software (I don't really think it is, but lets just call it a software)

Cheers!
 
This work is produced under the following creative commons license: 
 
Creative Commons Licence
AndroidWifi by Muhammad Asad is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at http://seevisionc.blogspot.co.uk/2012/06/androidwifi-alternative-to-connectify.html.

_______________________________________________________________________________________
Update(13/08/2013): I am seeing a lot of bloggers copying this blogpost as it is on their blogs without mentioning the source where they copied it from. For this reason I have created a creative commons license for this, which means that you can copy, modify and use the content as long as you share your software free of charge and mention the source.
_______________________________________________________________________________________

Update (11/03/2013): I have been really really busy with work, and therefore have limited time to answer everyone's questions. If you get stuck somewhere, then please read all comments as solution to almost every problem you can come across can be found in the comments. If you succeed please post the following details in comments below, as these might help anyone trying to share internet with similar setup as yours:

1. Windows Version
2. Mobile Model
3. Type of Internet Shared 
4. Android Version.

If you find out any additional detail that is missing, or anything which solved the problem you are having and is not listed below, PLEASE DO WRITE IN COMMENTS BELOW. THANK YOU!!

_______________________________________________________________________________________
Update (21/04/2013): I am seeing a number of interesting links coming in to this post. I thought it might be interesting for you people to find out about what other devices/areas this script is able to work.

1. This guide has been used by a user of roku streaming player to share his existing internet connection with the roku player. The original forum post can be found here, and might be able to solve a very common issue of not being able to access internet, despite being connected to the virtual router.

2. A question from a reddit user, which can be found here.

3. Other bloggers, translating and writing the same guide again with some modifications, so people can understand in their native language. This post can be accessed here

4. A senior forum member at xda developers forums recommended this method to other users. The full thread including the post can be found here

5. Users have recommended this method on pcmweb.nl forums. This post in Dutch. Thanks to google translate, the users are recommending this method over buying a wireless repeater hardware.

Click here to go to back to the start of this post
_______________________________________________________________________________________