has GPS Enabled - Android Hardware

Android examples for Hardware:Gps

Description

has GPS Enabled

Demo Code


//package com.java2s;
import android.content.Context;
import android.location.LocationManager;

public class Main {
    public static boolean hasGPSEnabled(Context context) {
        LocationManager locationManager = (LocationManager) context
                .getSystemService(Context.LOCATION_SERVICE);
        return locationManager
                .isProviderEnabled(LocationManager.GPS_PROVIDER);
    }//w  w w . j a  v  a  2  s.  c  om
}

Related Tutorials