Android examples for Map:GPS
Checks whether GPS is enabled on the device
//package com.java2s; import android.content.Context; import android.location.LocationManager; public class Main { /**//from ww w .ja v a2s . c o m * Checks whether GPS is enabled on the device * @param context The context to check with * @return True if GPS is enabled */ public static boolean isGpsProviderEnabled(Context context) { if (context == null) { return false; } LocationManager locationManager = (LocationManager) context .getSystemService(Context.LOCATION_SERVICE); return locationManager != null && locationManager .isProviderEnabled(LocationManager.GPS_PROVIDER); } }