Java tutorial
//package com.java2s; import android.content.Context; import android.location.LocationManager; import java.util.List; public class Main { public static boolean isGPSEnabled(Context cxt) { LocationManager locationManager = ((LocationManager) cxt.getSystemService(Context.LOCATION_SERVICE)); List<String> accessibleProviders = locationManager.getProviders(true); return accessibleProviders != null && accessibleProviders.size() > 0; } }