string logloc =""; locationmanager lm = (locationmanager)getsystemservice(context.location_service); location location = lm.getlastknownlocation(locationmanager.gps_provider); if (location!=null) { double longitude = location.getlongitude(); double latitude = location.getlatitude(); logloc = string.valueof(latitude)+","+string.valueof(longitude); notfi(logloc); } in above code location getting null gps device on , both outside building , inside building , i'm getting null value , kindly me run code
just becuase device has not last known location, thats why. first make code onlocationchanged(). current location , save lastknownlocation. method work.
you can take current location here