private void getLocation(){
locationManager = (LocationManager) getContext().getSystemService(Context.LOCATION_SERVICE);
List providers = locationM
getLastKnownLocation() frequently returns null. This is perfectly normal. You only use getLastKnownLocation():
Otherwise, you need to postpone your HTTP GET request until you get a location given to you in onLocationChanged(). Bear in mind that you may never get a location fix.
The proper use of LocationManager is covered in the documentation.