Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.location.LocationManager; public class Main { /** * This Function check the GPS enable/disable Status. Remember to add * required Permission in Manifest. * * See below for @params. */ public static boolean isGPSEnable(Context ctx) { LocationManager locationManager = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE); return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); } }