Example usage for android.content Context LOCATION_SERVICE

List of usage examples for android.content Context LOCATION_SERVICE

Introduction

In this page you can find the example usage for android.content Context LOCATION_SERVICE.

Prototype

String LOCATION_SERVICE

To view the source code for android.content Context LOCATION_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.location.LocationManager for controlling location updates.

Usage

From source file:com.cmput301w17t07.moody.MapsActivity.java

/**
 * Manipulates the map once available./*from ww w.  j  ava2 s . co m*/
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    //check the permission
    if (ActivityCompat.checkSelfPermission(getApplicationContext(),
            Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
            && ActivityCompat.checkSelfPermission(getApplicationContext(),
                    Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        // TODO: Consider calling
        Toast.makeText(getApplicationContext(), "Unable to access location." + " Please check your permissions",
                Toast.LENGTH_SHORT).show();
        return;
    }

    filterFeeling = intent.getStringExtra("feelingFilter");
    //------------------------- MAP FILTERS FOR USER'S MOODS -----------------------------------
    if (user == 0) {

        if (filterFeeling.equals("all")) {
            try {
                moodArrayList = MoodController.getUserMoods(username, String.valueOf(0), MapsActivity.this,
                        false, String.valueOf(100));
            } catch (Exception e) {
                System.out.println("Error when trying to retrieve user's "
                        + "location based mood history for all feelings" + e);
            }
        } else {
            ElasticMoodController.GetFeelingFilterMoods getFeelingFilterMoods = new ElasticMoodController.GetFeelingFilterMoods();
            getFeelingFilterMoods.execute(username, filterFeeling);

            try {
                moodArrayList = getFeelingFilterMoods.get();
            } catch (Exception e) {
                Log.i("error", "failed to get filtered feeling moods in map activity");
            }
        }
        // Plotting of location based points on map
        for (int i = 0; i < moodArrayList.size(); i++) {
            Mood mood = moodArrayList.get(i);
            if (mood.getLongitude() == 0 && mood.getLatitude() == 0) {
                break;
            } else {
                double longitude;
                double latitude;
                longitude = moodArrayList.get(i).getLongitude();
                latitude = moodArrayList.get(i).getLatitude();
                LatLng tmp = new LatLng(latitude, longitude);
                mMap.addMarker(new MarkerOptions().position(tmp).title(mood.getFeeling())
                        .icon(BitmapDescriptorFactory.defaultMarker(setMarkerColor(mood.getFeeling()))));
                mMap.moveCamera(CameraUpdateFactory.newLatLng(tmp));
            }
        }

    }
    //--------------------- MAP FILTERS FOR USER'S TIMELINE'S MOODS ----------------------------
    else if (user == 1) {
        FollowController followController = new FollowController();
        FollowingList followingList = followController.getFollowingList(username);

        if (filterFeeling.equals("all")) {
            try {
                moodArrayList = MoodController.getTimelineMoods(username, String.valueOf(0), MapsActivity.this);
            } catch (Exception e) {
                System.out.println("Error with getting timeline mood in MapsActivity" + e);

            }
        } else {

            nameList.addAll(followingList.getFollowingList());
            try {
                for (int i = 0; i < nameList.size(); i++) {

                    ElasticMoodController.GetFeelingFilterMoods getFeelingFilterMoods = new ElasticMoodController.GetFeelingFilterMoods();
                    getFeelingFilterMoods.execute(nameList.get(i).toString(), filterFeeling);

                    try {
                        moodArrayList.addAll(getFeelingFilterMoods.get());

                    } catch (Exception e) {
                        System.out
                                .println("Error with getting filtered" + " timeline moods in MapsActivity" + e);
                    }
                }
            } catch (Exception e) {
            }
        }

        for (int j = 0; j < moodArrayList.size(); j++) {
            Mood mood = moodArrayList.get(j);
            if (mood.getLongitude() == 0 && mood.getLatitude() == 0) {
                break;
            } else {
                double longitude;
                double latitude;
                longitude = mood.getLongitude();
                latitude = mood.getLatitude();
                LatLng tmp = new LatLng(latitude, longitude);
                mMap.addMarker(new MarkerOptions().position(tmp).title(mood.getDisplayUsername())
                        .snippet(mood.getFeeling())
                        .icon(BitmapDescriptorFactory.defaultMarker(setMarkerColor(mood.getFeeling()))));
                mMap.moveCamera(CameraUpdateFactory.newLatLng(tmp));

            }
        }

    }
    //--------------------------- ALL MOODS WITHIN 5KM OF THE USER -----------------------------
    else if (user == 2) {

        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        //check available tools
        List<String> locationList = locationManager.getProviders(true);
        if (locationList.contains(LocationManager.GPS_PROVIDER)) {
            provider = LocationManager.GPS_PROVIDER;
        } else if (locationList.contains(LocationManager.NETWORK_PROVIDER)) {
            provider = LocationManager.NETWORK_PROVIDER;
        } else {
            Toast.makeText(getApplicationContext(), "No map to use", Toast.LENGTH_LONG).show();
        }

        location = locationManager.getLastKnownLocation(provider);
        if (location == null) {
            latitude = 0;
            longitude = 0;
        } else {
            latitude = location.getLatitude();
            longitude = location.getLongitude();
        }

        UserController userController = new UserController();
        username = userController.readUsername(MapsActivity.this).toString();

        ElasticMoodController.FilterMapByLocation filterMapByLocation = new ElasticMoodController.FilterMapByLocation();
        filterMapByLocation.execute(location);

        try {
            currLocationArrayList.addAll(filterMapByLocation.get());
        } catch (Exception e) {
            System.out.println("this is fff" + e);
        }

        for (int p = 0; p < currLocationArrayList.size(); p++) {
            Location locationNear = new Location("near");
            locationNear.setLatitude(currLocationArrayList.get(p).getLatitude());
            locationNear.setLongitude(currLocationArrayList.get(p).getLongitude());
            float distance = location.distanceTo(locationNear);
            if (distance <= 5000.0) {
                currLocationArrayListWith5Km.add(currLocationArrayList.get(p));
            }

        }

        for (int j = 0; j < currLocationArrayListWith5Km.size(); j++) {
            Mood mood = currLocationArrayListWith5Km.get(j);
            if (mood.getLongitude() == 0 && mood.getLatitude() == 0) {
                break;
            } else {
                double longitude;
                double latitude;
                longitude = mood.getLongitude();
                latitude = mood.getLatitude();
                LatLng tmp = new LatLng(latitude, longitude);
                mMap.addMarker(new MarkerOptions().position(tmp).title(mood.getDisplayUsername())
                        .snippet(mood.getFeeling())
                        .icon(BitmapDescriptorFactory.defaultMarker(setMarkerColor(mood.getFeeling()))));
                float zoomLevel = 12.0f;
                mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(tmp, zoomLevel));
            }
        }

    }

}

From source file:com.nextgis.firereporter.GetFiresService.java

protected void Prepare() {
    mLocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    mnCurrentExec = 0;/*from  ww  w.ja  va 2s  .  c  o m*/
    mmoFires = new HashMap<Long, FireItem>();

    mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nUserCount = 0;
    nNasaCount = 0;
    nScanexCount = 0;
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addParentStack(MainActivity.class);
    stackBuilder.addNextIntent(new Intent(this, MainActivity.class));
    //stackBuilder.addNextIntent(new Intent(this, ScanexNotificationsActivity.class));
    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

    mBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_fire_small)
            .setContentTitle(getString(R.string.stNewFireNotifications));
    mBuilder.setContentIntent(resultPendingIntent);

    Intent delIntent = new Intent(this, GetFiresService.class);
    delIntent.putExtra(COMMAND, SERVICE_NOTIFY_DISMISSED);
    PendingIntent deletePendingIntent = PendingIntent.getService(this, 0, delIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    mBuilder.setDeleteIntent(deletePendingIntent);

    mInboxStyle = new NotificationCompat.InboxStyle();
    mInboxStyle.setBigContentTitle(getString(R.string.stNewFireNotificationDetailes));

    LoadScanexData();

    mSanextCookieTime = new Time();
    mSanextCookieTime.setToNow();
    msScanexLoginCookie = new String("not_set");

    mFillDataHandler = new Handler() {
        public void handleMessage(Message msg) {

            mnCurrentExec--;

            Bundle resultData = msg.getData();
            boolean bHaveErr = resultData.getBoolean(ERROR);
            if (bHaveErr) {
                SendError(resultData.getString(ERR_MSG));
            } else {
                int nType = resultData.getInt(SOURCE);
                String sData = resultData.getString(JSON);
                switch (nType) {
                case 3:
                    FillScanexData(nType, sData);
                    break;
                case 4:
                    msScanexLoginCookie = sData;
                    mSanextCookieTime.setToNow();
                    GetScanexData(false);
                    break;
                default:
                    FillData(nType, sData);
                    break;
                }
            }
            GetDataStoped();
        };
    };
}

From source file:com.eutectoid.dosomething.PickerActivity.java

@Override
protected void onStop() {
    super.onStop();
    // API 23: we have to check if ACCESS_FINE_LOCATION and/or ACCESS_COARSE_LOCATION permission are granted
    if (ContextCompat.checkSelfPermission(this,
            android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
            || ContextCompat.checkSelfPermission(this,
                    android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {

        if (locationListener != null) {
            LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
            locationManager.removeUpdates(locationListener);
            locationListener = null;/*from   w w  w .  ja v a  2  s .c  o  m*/
        }
    }
}

From source file:com.esri.cordova.geolocation.AdvancedGeolocation.java

private void validatePermissions() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        // Reference: Permission Groups https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous
        // As of July 2016 - ACCESS_WIFI_STATE and ACCESS_NETWORK_STATE are not considered dangerous permissions
        Log.d(TAG, "validatePermissions()");

        final int showRationale = _permissionsController.getShowRationale();

        if (_permissionsController.getAppPermissions()) {
            startLocation();//w ww. j  av  a2 s. co  m
        }
        // The user has said to never ask again about activating location services
        else if (showRationale == _permissionsController.DENIED_NOASK) {
            Log.w(TAG, ErrorMessages.LOCATION_SERVICES_DENIED_NOASK().message);
            sendCallback(PluginResult.Status.ERROR,
                    JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.LOCATION_SERVICES_DENIED_NOASK()));
        } else if (showRationale == _permissionsController.ALLOW) {
            requestPermissions();
        } else if (showRationale == _permissionsController.DENIED) {
            Log.w(TAG, "Rationale already shown, geolocation denied twice");
            sendCallback(PluginResult.Status.ERROR,
                    JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.LOCATION_SERVICES_DENIED()));
        }
    } else {
        final LocationManager _locationManager = (LocationManager) _cordovaActivity
                .getSystemService(Context.LOCATION_SERVICE);
        final boolean networkLocationEnabled = _locationManager
                .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
        final boolean gpsEnabled = _locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
        final boolean networkEnabled = isInternetConnected(_cordovaActivity.getApplicationContext());

        // If warnings are disabled then skip initializing alert dialog fragments
        if (!_noWarn && (!networkLocationEnabled || !gpsEnabled || !networkEnabled)) {
            alertDialog(gpsEnabled, networkLocationEnabled, networkEnabled);
        } else {
            startLocation();
        }
    }
}

From source file:com.metinkale.prayerapp.compass.Main.java

@Override
protected void onPause() {
    LocationManager locMan = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locMan.removeUpdates(this);
    super.onPause();
}

From source file:au.org.ala.fielddata.mobile.MobileFieldDataDashboard.java

@Override
public void onStart() {
    super.onStart();
    if (isLoggedIn()) {
        if (!preferences.getAskedAboutWifi()) {
            showWifiPreferenceDialog();//from w  ww  .j  av  a2 s .c om
        }

        if (!askedAboutGPS) {
            if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)) {
                LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
                if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                    showNoGpsDialog();
                }
            }
        }
    }
}

From source file:com.mobantica.DriverItRide.activities.ActivityLogin.java

private boolean valid() {
    if (edt_login_username.getText().toString().equals("")) {
        Toast.makeText(getApplicationContext(), getResources().getString(R.string.please_enter_username),
                Toast.LENGTH_SHORT).show();
        return false;
    }//from w w  w.  ja  v  a2  s . co  m

    if (edt_login_password.getText().toString().equals("")) {
        Toast.makeText(getApplicationContext(), getResources().getString(R.string.please_enter_password),
                Toast.LENGTH_SHORT).show();
        return false;
    }

    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        Toast.makeText(this, getResources().getString(R.string.need_location_permission_in_app_setting),
                Toast.LENGTH_SHORT).show();
        return false;
    }

    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
        Toast.makeText(this, getResources().getString(R.string.need_phone_permission_in_app_setting),
                Toast.LENGTH_SHORT).show();
        return false;
    }

    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        Toast.makeText(this,
                getResources().getString(R.string.need_write_external_storage_permissionin_app_setting),
                Toast.LENGTH_SHORT).show();
        return false;
    }

    LocationManager locationManager = (LocationManager) getApplicationContext()
            .getSystemService(Context.LOCATION_SERVICE);
    if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
            && !locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
        Toast.makeText(getApplicationContext(), getResources().getString(R.string.please_enable_location),
                Toast.LENGTH_SHORT).show();
        return false;
    }

    return true;
}

From source file:com.ibm.mf.geofence.demo.MapsActivity.java

/**
 * Sets up the map if it is possible to do so (i.e., the Google Play services APK is correctly installed) and the map has not already been instantiated.
 *///from  w  w w .ja v  a2  s . co m
void setUpMapIfNeeded() {
    if (googleMap == null) {
        googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
        log.debug("setUpMapIfNeeded() : googleMap = " + googleMap);
        if (googleMap != null) {
            LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
            try {
                if (currentLocation == null)
                    currentLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
            } catch (SecurityException e) {
                log.debug("missing permission to request get last location from NETWORK_PROVIDER");
            }
            initGeofences();
            // receive updates for th ecurrent location
            try {
                locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 10000, 10f,
                        new android.location.LocationListener() {
                            @Override
                            public void onLocationChanged(Location location) {
                                currentLocation = location;
                                refreshCurrentLocation();
                            }

                            @Override
                            public void onStatusChanged(String provider, int status, Bundle extras) {
                            }

                            @Override
                            public void onProviderEnabled(String provider) {
                            }

                            @Override
                            public void onProviderDisabled(String provider) {
                            }
                        });
            } catch (SecurityException e) {
                log.debug("missing permission to request locations from NETWORK_PROVIDER");
            }
            // set the map center and zoom level/bounds once it is loaded
            googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
                @Override
                public void onMapLoaded() {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            List<MFGeofence> fences = geofenceHolder.getFences();
                            LatLng latlng = currentLocation != null
                                    ? new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude())
                                    : googleMap.getCameraPosition().target;
                            Map<String, Object> map = (fences != null) && !fences.isEmpty()
                                    ? DemoUtils.computeBounds(fences, latlng)
                                    : DemoUtils.computeBounds(latlng, 0.0005, 0.0005);
                            log.debug("setUpMapIfNeeded() : bounds map = " + map + ", fences = " + fences);
                            LatLngBounds bounds = (LatLngBounds) map.get("bounds");
                            LatLng loc = (LatLng) map.get("center");
                            if (currentZoom >= 0f) {
                                log.debug("setUpMapIfNeeded() setting zoom");
                                googleMap.moveCamera(CameraUpdateFactory.zoomTo(currentZoom));
                            } else {
                                log.debug("setUpMapIfNeeded() setting bounds");
                                googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
                            }
                            refreshCurrentLocation(loc.latitude, loc.longitude);
                        }
                    });
                }
            });
            // respond to taps on the fences labels
            googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
                @Override
                public boolean onMarkerClick(Marker marker) {
                    if (mapMode != MODE_EDIT) {
                        GeofenceInfo info = getGeofenceInfoForMarker(marker);
                        log.debug(String.format("onMarkerClick(marker=%s) info=%s", marker, info));
                        EditGeofenceDialog dialog = new EditGeofenceDialog();
                        dialog.customInit(MapsActivity.this, EditGeofenceDialog.MODE_UPDATE_DELETE, info);
                        dialog.show(getFragmentManager(), "geofences");
                    }
                    return true;
                }
            });
        }
    }
}

From source file:com.google.android.apps.paco.ExperimentExecutorCustomRendering.java

private void registerLocationListener() {
    LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    if (!lm.isProviderEnabled("gps")) {
        new AlertDialog.Builder(this).setMessage(R.string.gps_message).setCancelable(true)
                .setPositiveButton(R.string.enable_button, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        launchGpsSettings();
                        dialog.dismiss();
                    }//from   www  .  jav  a  2 s .c o  m
                }).setNegativeButton(R.string.cancel_button, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                }).create().show();
    }
    if (lm != null) {
        getBestProvider(lm);
    }
}

From source file:com.landenlabs.all_devtool.GpsFragment.java

@SuppressWarnings("deprecation")
@Override/*  ww w. j  a  v  a  2 s  .  co  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);

    View rootView = inflater.inflate(R.layout.gps_tab, container, false);
    m_statusIcon = Ui.viewById(rootView, R.id.gpsStatus);
    m_statusIcon.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
        }
    });

    Ui.viewById(rootView, R.id.gps_clear).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            clearList();
        }
    });

    m_list.clear();
    // ---- Get UI components  ----
    for (int idx = 0; idx != s_maxRows; idx++)
        m_list.add(null);
    m_list.set(s_providersRow, new GpsInfo(new GpsItem("Providers")));
    m_list.set(s_lastUpdateRow, new GpsInfo(new GpsItem("Last Update")));
    m_list.set(s_detailRow, new GpsInfo(new GpsItem("Detail History")));

    m_listView = Ui.viewById(rootView, R.id.gpsListView);
    final GpsArrayAdapter adapter = new GpsArrayAdapter(this.getActivity());
    m_listView.setAdapter(adapter);

    // ---- Setup GPS ----
    m_locMgr = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);

    m_gpsTv = Ui.viewById(rootView, R.id.gps);
    if (isGooglePlayServicesAvailable()) {
        m_locationRequest = new LocationRequest();
        m_locationRequest.setInterval(GPS_INTERVAL);
        m_locationRequest.setFastestInterval(GPS_FASTEST_INTERVAL);
        // Priority needs to match permissions.
        //  Use LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY with
        // <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
        //  Use LocationRequest.PRIORITY_HIGH_ACCURACY with
        // <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
        m_locationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);

        m_googleApiClient = new GoogleApiClient.Builder(this.getActivity()).addApi(LocationServices.API)
                .addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();

        m_gpsTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                m_gpsMonitor = !m_gpsMonitor;
                view.setSelected(m_gpsMonitor);
                addMsgToDetailRow(s_colorMsg, m_gpsMonitor ? "Start Monitor" : "Stop Monitor");
                showProviders();
            }
        });

    } else {
        m_gpsTv.setText("Need Google Play Service");
    }

    if (ActivityCompat.checkSelfPermission(getContext(),
            Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        m_locMgr.addGpsStatusListener(this);
    }

    /*  http://stackoverflow.com/questions/11398732/how-do-i-receive-the-system-broadcast-when-gps-status-has-changed
    <uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <receiver android:name=".GpsReceiver">
    <intent-filter>
         <action android:name="android.location.GPS_ENABLED_CHANGE" />
         <action android:name="android.location.PROVIDERS_CHANGED" />
    </intent-filter>
    </receiver>
    */
    // GpsReceiver m_gpsReceiver = new GpsReceiver();
    m_intentFilter.addAction(GpsReceiver.GPS_ENABLED_CHANGE_ACTION);
    if (Build.VERSION.SDK_INT >= 19) {
        m_intentFilter.addAction(LocationManager.MODE_CHANGED_ACTION);
    }
    m_intentFilter.addAction(GpsReceiver.GPS_FIX_CHANGE_ACTION);
    m_intentFilter.addAction(LocationManager.PROVIDERS_CHANGED_ACTION);

    showProviders();
    // TODO - get available providers
    getCheckBox(rootView, R.id.gpsFuseCb, FUSED_PROVIDER);
    getCheckBox(rootView, R.id.gpsGPSCb, LocationManager.GPS_PROVIDER);
    getCheckBox(rootView, R.id.gpsNetwkCb, LocationManager.NETWORK_PROVIDER);
    getCheckBox(rootView, R.id.gpsLowPwrCb, LocationManager.PASSIVE_PROVIDER);
    getCheckBox(rootView, R.id.gpsStatusCb, STATUS_CB);

    for (CheckBox cb : m_providersCb.values()) {
        cb.setOnClickListener(this);
    }
    initLastUpdate();

    // Expand All
    for (int idx = 0; idx != s_maxRows; idx++)
        m_listView.expandGroup(idx);

    return rootView;
}