is Gps Enabled - Android Hardware

Android examples for Hardware:Gps

Description

is Gps Enabled

Demo Code


//package com.java2s;

import java.util.List;

import android.content.Context;

import android.location.LocationManager;

public class Main {

    public static boolean isGpsEnabled(Context context) {
        LocationManager locationManager = ((LocationManager) context
                .getSystemService(Context.LOCATION_SERVICE));
        List<String> accessibleProviders = locationManager
                .getProviders(true);/* w ww.  j  av  a  2 s  .co m*/
        return accessibleProviders != null
                && accessibleProviders.size() > 0;
    }
}

Related Tutorials