How to check whether GPS is available in ANDROID or Not?

By | February 24, 2011

This code helps you to check whether the location service is available on your ANDROID Phone or not.
Copy this code and paste to your file.
Happy coding…..

 public boolean GPSAvailable() {
     LocationManager loc_manager = (LocationManager)
     getSystemService(Context.LOCATION_SERVICE);
     List<string> str = loc_manager.getProviders(true);

     if(str.size()>0)
         return true;
     else
         return false;
}

One thought on “How to check whether GPS is available in ANDROID or Not?

Leave a Reply

Your email address will not be published. Required fields are marked *