Java tutorial
//package com.java2s; import java.util.List; import android.content.Context; import android.location.LocationManager; public class Main { public static boolean isGPSAvailable(Context context) { List list = ((LocationManager) context.getSystemService("location")).getProviders(true); boolean flag = true; if (list != null) { if (list.size() == 1 && "passive".equals(list.get(0))) flag = false; } else { flag = false; } return flag; } }