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