Purpose - Check if GPS is present. - Android Hardware

Android examples for Hardware:Gps

Description

Purpose - Check if GPS is present.

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.pm.PackageManager;

public class Main {
    /**/*w w w.j  av a  2 s  . c  o  m*/
     * Purpose - Check if GPS is present.
     * 
     * @param context Current Activity\Context from which this method is called
     * */
    public static boolean getGPSPresentStatus(Context context) {
        if (context == null)
            return false;
        PackageManager pm = context.getPackageManager();
        return pm.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS);
    }
}

Related Tutorials