Android Location is null
<p>I want to Retrive The Location of device. i am doing it on my emulator. My emulator is Google Api's (Google inc.).I am using LocationManager class and GPS provider to get the current location but my location is always null. i gave my emulator dummy coordinates and added all the permissions in the manifest.</p>

<pre><code>import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Toast;

public class Main extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    LocationManager lm = (LocationManager) getSystemService(LOCATION_SERVICE);
    Location l = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
    if (l!= null) {
        Toast.makeText(this, "Location is null", 300).show();
    }else{
        Toast.makeText(this,"Location is not null",300).show();
    }
}

}
</code></pre>

<p>Manifest.xml</p>

<pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.gotya"
    android:versionCode="1"
    android:versionName="1.0" &gt;

&lt;uses-sdk
    android:minSdkVersion="6"
    android:targetSdkVersion="10" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
&lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/&gt;
&lt;uses-permission android:name="android.permission.INTERNET"/&gt;
&lt;uses-permission android:name="android.permission.RECEIVE_SMS"/&gt;

&lt;application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" &gt;
    &lt;activity
        android:name="com.example.gotya.Main"
        android:label="@string/app_name" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;

            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;receiver android:name=".CodeReceiver"&gt;
        &lt;intent-filter &gt;
            &lt;action android:name="android.provider.Telephony.SMS_RECEIVED"/&gt;
        &lt;/intent-filter&gt;
    &lt;/receiver&gt;
&lt;/application&gt;
</code></pre>

<p></p>
