This Function check the GPS enable/disable Status. - Android Hardware

Android examples for Hardware:Gps

Description

This Function check the GPS enable/disable Status.

Demo Code


//package com.java2s;

import android.content.Context;
import android.location.LocationManager;

public class Main {
    /**// ww w.j ava2s.co  m
     * 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);
    }
}

Related Tutorials