Java tutorial
//package com.java2s; /** * LocationHelper.java * Implements the LocationHelper class * A LocationHelper offers helper methods for dealing with location issues * * This file is part of * TRACKBOOK - Movement Recorder for Android * * Copyright (c) 2016-17 - Y20K.org * Licensed under the MIT-License * http://opensource.org/licenses/MIT * * Trackbook uses osmdroid - OpenStreetMap-Tools for Android * https://github.com/osmdroid/osmdroid */ import android.content.Context; import android.provider.Settings; public class Main { public static boolean checkLocationSystemSetting(Context context) { int locationSettingState = 0; try { locationSettingState = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE); } catch (Settings.SettingNotFoundException e) { e.printStackTrace(); } return locationSettingState != Settings.Secure.LOCATION_MODE_OFF; } }