how to connect android phone with ubuntu 12.04 laptop for accessing laptop's internet connection over wifi

Some mobile devices doesn't able to detect the hotspot created on ubuntu by default method.
Solution for this problem is to install ap-hotspot software on Ubuntu.


For Ubuntu 12.10,13.04,13.10


Run these commands to install ap-hotspot.

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install ap-hotspot

Run these commands to start and stop ap-hotspot.

sudo ap-hotspot start
sudo ap-hotspot stop

Run this command to configure ap-hotspot

sudo ap-hotspot configure

enter image description here

If it asks for WPA passphrase give a key with the minimum of 8 characters.


OR

For Ubuntu 12.04

you can download the script from here.This script requires Hostapd 1.0 which was available by default in Ubuntu 12.10,13.04,13.10.

For Ubuntu 12.04,add these two lines to /etc/apt/sources.list

deb http://ppa.launchpad.net/network-manager/ppa/ubuntu precise main
deb-src http://ppa.launchpad.net/network-manager/ppa/ubuntu precise main

and save the file and run the below commands in terminal.

sudo apt-get update
sudo apt-get install hostapd