Location is null inside onHandleIntent()
<p>i am using <code>IntentService</code> and getting the location of device by using <code>LocationManager</code>. but when i get the location my location is always null. why ?
here is my code</p>

<pre><code>package com.example.netlogger.Services;

import java.util.ArrayList;
import java.util.Date;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;

import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;

public class LocationLogService extends IntentService {

    SharedPreferences prefs;
    LocationManager lm;
    Location l;
    LocationListener ls = new LocationListener() {

        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onProviderEnabled(String provider) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onProviderDisabled(String provider) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onLocationChanged(Location location) {
            // TODO Auto-generated method stub
            l = location;
        }
    };

    public LocationLogService() {
        super("some name");
    }

    @Override
    protected void onHandleIntent(Intent intent) {

        Log.d("TAGG", "HERE");
        prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
        lm = (LocationManager) getBaseContext().getSystemService(
                LOCATION_SERVICE);
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ls);
        l = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if (l != null) {
            Log.d("TAGG", "NOT NULL");
        }

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.d("", "done");
        lm.removeUpdates(ls);
    }

}
</code></pre>
