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