User Location Not Found :- Latitude And Longitude In Android
My code putput always goes in else part. IT means {location} is null. Any suggestions? locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); locManager.requestL
Solution 1:
If locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER) returns null then it means you have never been located.
If you want to get the new location, you should make you activity extend the LocationListener interface and implement the following.
publicvoidonLocationChanged(Location location) {
// Code to execute after being located
}
publicvoidonProviderDisabled(String provider) {
}
publicvoidonProviderEnabled(String provider) {
}
publicvoidonStatusChanged(String provider, int status, Bundle extras) {
}
Don't forget to remove the location updates afterwards.
Post a Comment for "User Location Not Found :- Latitude And Longitude In Android"