Fork me
BeyondAR
Augmented Reality Framework for Android
 All Classes Functions Variables
com.beyondar.android.util.location.BeyondarLocationManager Class Reference

This class provides a helper to get the best location. More...

Static Public Member Functions

static void setLocationManager (LocationManager locationManager)
 Set the LocationManager needed by the helper to be able to take care of the location. More...
 
static void addGeoObjectLocationUpdate (GeoObject geoObject)
 Add a GeoObject that will be updated with the user location. More...
 
static void removeGeoObjectLocationUpdate (GeoObject geoObject)
 Remove the specified GeoObject to don't get any update about the user location. More...
 
static void removeAllGeoObjectsUpdates ()
 Remove all the GeoObject to get the location updates.
 
static void addWorldLocationUpdate (World world)
 Add a World object that will be updated with the user location. More...
 
static void removeWorldLocationUpdate (World world)
 Remove the specified World to don't get any update about the user location. More...
 
static void removeAllWorldsUpdates ()
 Remove all the World to get the location updates.
 
static void addLocationListener (LocationListener locationListener)
 Add a LocationListener object that will be updated with the user location. More...
 
static void removeLocationListener (LocationListener locationListener)
 Remove the specified LocationListener to don't get any update about the user location. More...
 
static void removeAllLocationListener ()
 Remove all the LocationListener to get the location updates.
 
static void enable ()
 Enable the location services for the helper. More...
 
static void disable ()
 Disable the location services for the helper. More...
 
static boolean isEnabled ()
 Check if location is enabled or not. More...
 
static boolean gpsFix ()
 Check if the satellites are giving a correct location. More...
 

Static Public Attributes

static final int MAX_TIME_GPS_FIX = 20000
 

Detailed Description

This class provides a helper to get the best location.

To do that the application needs to add the following permissions in the manifest:

    android.permission.ACCESS_FINE_LOCATION
    android.permission.ACCESS_COARSE_LOCATION

Remember that you also can use the Location utility in the Google Services.

Here is a small example how to use BeyondarLocationManager:


void onCreate(Bundle savedInstanceState){
    BeyondarLocationManager.setLocationManager((LocationManager) this.getSystemService(Context.LOCATION_SERVICE));
    BeyondarLocationManager.addGeoObjectLocationUpdate(beyondarObject);
    // You also can register a World or a LocationListener
    // Don't forget to remove the object that you register
}
void onResume(){
    BeyondarLocationManager.enable();
}
void onPause(){
    BeyondarLocationManager.disable();
}

Member Function Documentation

static void com.beyondar.android.util.location.BeyondarLocationManager.addGeoObjectLocationUpdate ( GeoObject  geoObject)
static

Add a GeoObject that will be updated with the user location.

Parameters
geoObject
static void com.beyondar.android.util.location.BeyondarLocationManager.addLocationListener ( LocationListener  locationListener)
static

Add a LocationListener object that will be updated with the user location.

Parameters
locationListener
static void com.beyondar.android.util.location.BeyondarLocationManager.addWorldLocationUpdate ( World  world)
static

Add a World object that will be updated with the user location.

Parameters
world
static void com.beyondar.android.util.location.BeyondarLocationManager.disable ( )
static

Disable the location services for the helper.

If the location is not needed use this method in order to save battery.

static void com.beyondar.android.util.location.BeyondarLocationManager.enable ( )
static

Enable the location services for the helper.

Once it will be enabled it will start consuming battery.

static boolean com.beyondar.android.util.location.BeyondarLocationManager.gpsFix ( )
static

Check if the satellites are giving a correct location.

Returns
static boolean com.beyondar.android.util.location.BeyondarLocationManager.isEnabled ( )
static

Check if location is enabled or not.

Returns
static void com.beyondar.android.util.location.BeyondarLocationManager.removeGeoObjectLocationUpdate ( GeoObject  geoObject)
static

Remove the specified GeoObject to don't get any update about the user location.

Parameters
geoObject
static void com.beyondar.android.util.location.BeyondarLocationManager.removeLocationListener ( LocationListener  locationListener)
static

Remove the specified LocationListener to don't get any update about the user location.

Parameters
locationListener
static void com.beyondar.android.util.location.BeyondarLocationManager.removeWorldLocationUpdate ( World  world)
static

Remove the specified World to don't get any update about the user location.

Parameters
world
static void com.beyondar.android.util.location.BeyondarLocationManager.setLocationManager ( LocationManager  locationManager)
static

Set the LocationManager needed by the helper to be able to take care of the location.

Parameters
locationManager

The documentation for this class was generated from the following file: