Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #2954 - Setting up LOST client
Browse files Browse the repository at this point in the history
  • Loading branch information
bleege committed Dec 9, 2015
1 parent 96591c4 commit a7307f0
Showing 1 changed file with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
package com.mapbox.mapboxsdk.location;

import android.content.Context;
import android.support.annotation.NonNull;
import com.mapzen.android.lost.api.LocationRequest;
import com.mapzen.android.lost.api.LostApiClient;

public class LocationServices {

private static LocationServices instance = null;

private LostApiClient mLocationClient;
private LocationRequest mLocationRequest;


/**
* Private constructor for singleton LocationServices
*/
private LocationServices() {
private LocationServices(Context context) {
super();
// Setup location services
mLocationClient = new LostApiClient.Builder(context).build();
mLocationRequest = LocationRequest.create()
.setFastestInterval(1000)
.setSmallestDisplacement(3.0f)
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}

/**
* Primary (singleton) access method for LocationServices
* @param context Context
* @return LocationServices
*/
public static LocationServices getLocationServices() {
public static LocationServices getLocationServices(@NonNull final Context context) {
if (instance == null) {
instance = new LocationServices();
if (context == null) {
throw new NullPointerException("Context required for accessing LocationServices");
}
instance = new LocationServices(context);
}
return instance;
}
Expand Down

0 comments on commit a7307f0

Please sign in to comment.