is Gps Enabled - Android android.location

Android examples for android.location:GPS

Description

is Gps Enabled

Demo Code

import android.content.Context;
import android.location.LocationManager;

public class Main {

  /**//  w  w  w. ja v a 2  s  .  c o  m
   * <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
   */
  public static boolean isGpsEnabled(Context context) {
    LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    return lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
  }

}

Related Tutorials