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 locationManager = ((LocationManager) context.getSystemService(Context.LOCATION_SERVICE)); List<String> accessibleProviders = locationManager.getProviders(true); return accessibleProviders != null && accessibleProviders.size() > 0; } }