Java Code Examples for android.location.Location#setSpeed()

The following examples show how to use android.location.Location#setSpeed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocationHooker.java    From DoraemonKit with Apache License 2.0 6 votes vote down vote up
private static Location buildValidLocation(String provider) {
    if (TextUtils.isEmpty(provider)) {
        provider = "gps";
    }
    Location validLocation = new Location(provider);
    validLocation.setAccuracy(5.36f);
    validLocation.setBearing(315.0f);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        validLocation.setBearingAccuracyDegrees(52.285362f);
    }
    validLocation.setSpeed(0.79f);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        validLocation.setSpeedAccuracyMetersPerSecond(0.9462558f);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        validLocation.setVerticalAccuracyMeters(8.0f);
    }
    validLocation.setTime(System.currentTimeMillis());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        validLocation.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
    }
    return validLocation;
}
 
Example 2
Source File: BackgroundService.java    From BackPackTrackII with GNU General Public License v3.0 6 votes vote down vote up
public Location deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
        throws JsonParseException {
    JsonObject jObject = (JsonObject) json;
    Location location = new Location(jObject.get("Provider").getAsString());

    location.setTime(jObject.get("Time").getAsLong());
    location.setLatitude(jObject.get("Latitude").getAsDouble());
    location.setLongitude(jObject.get("Longitude").getAsDouble());

    if (jObject.has("Altitude"))
        location.setAltitude(jObject.get("Altitude").getAsDouble());

    if (jObject.has("Speed"))
        location.setSpeed(jObject.get("Speed").getAsFloat());

    if (jObject.has("Bearing"))
        location.setBearing(jObject.get("Bearing").getAsFloat());

    if (jObject.has("Accuracy"))
        location.setAccuracy(jObject.get("Accuracy").getAsFloat());

    return location;
}
 
Example 3
Source File: ReplayJsonRouteLocationMapper.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
private List<Location> mapReplayLocations() {
  List<Location> locations = new ArrayList<>(replayLocations.size());
  for (ReplayLocationDto sample : replayLocations) {
    Location location = new Location(REPLAY);
    location.setLongitude(sample.getLongitude());
    location.setAccuracy(sample.getHorizontalAccuracyMeters());
    location.setBearing((float) sample.getBearing());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
      location.setVerticalAccuracyMeters(sample.getVerticalAccuracyMeters());
    }
    location.setSpeed((float) sample.getSpeed());
    location.setLatitude(sample.getLatitude());
    location.setAltitude(sample.getAltitude());
    Date date = sample.getDate();
    if (date != null) {
      location.setTime(date.getTime());
    }
    locations.add(location);
  }
  return locations;
}
 
Example 4
Source File: BackgroundLocation.java    From background-geolocation-android with Apache License 2.0 6 votes vote down vote up
/**
 * Return android Location instance
 *
 * @return android.location.Location instance
 */
public Location getLocation() {
    Location l = new Location(provider);
    l.setLatitude(latitude);
    l.setLongitude(longitude);
    l.setTime(time);
    if (hasAccuracy) l.setAccuracy(accuracy);
    if (hasAltitude) l.setAltitude(altitude);
    if (hasSpeed) l.setSpeed(speed);
    if (hasBearing) l.setBearing(bearing);
    l.setExtras(extras);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        l.setElapsedRealtimeNanos(elapsedRealtimeNanos);
    }

    return l;
}
 
Example 5
Source File: LocationFactory.java    From io.appium.settings with Apache License 2.0 6 votes vote down vote up
public synchronized Location createLocation(String providerName, float accuracy) {
    Location l = new Location(providerName);
    l.setAccuracy(accuracy);

    l.setLatitude(latitude);
    l.setLongitude(longitude);
    l.setAltitude(altitude);
    l.setSpeed(0);
    l.setBearing(0);

    l.setTime(System.currentTimeMillis());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        l.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
    }
    return l;
}
 
Example 6
Source File: DebugViewTest.java    From open with GNU General Public License v3.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    debugView = new DebugView(application);

    Location currentLocation = TestHelper.getTestLocation(40.660713, -73.989341);
    currentLocation.setBearing(130);
    currentLocation.setSpeed(milesPerHourToMetersPerSecond(30));
    debugView.setCurrentLocation(currentLocation);

    Location snapLocation = TestHelper.getTestLocation(41.660713, -74.989341);
    snapLocation.setBearing(140);
    snapLocation.setSpeed(milesPerHourToMetersPerSecond(40));
    debugView.setSnapLocation(snapLocation);

    Route route = new Route(TestHelper.MOCK_AROUND_THE_BLOCK);
    Instruction instruction = route.getRouteInstructions().get(0);
    debugView.setClosestInstruction(instruction);
    debugView.setClosestDistance(30);
}
 
Example 7
Source File: Sensors.java    From Multiwii-Remote with Apache License 2.0 6 votes vote down vote up
public void setMOCKLocation(double Latitude, double Longitude, float Altitude, float Heading, float speed) {

		Location mockLocation = new Location(mocLocationProvider); // a string
		mockLocation.setLatitude(Latitude); // double
		mockLocation.setLongitude(Longitude);
		mockLocation.setAltitude(Altitude);
		mockLocation.setTime(System.currentTimeMillis());
		mockLocation.setAccuracy(1);
		mockLocation.setBearing(Heading);
		mockLocation.setSpeed(speed * 0.01f);

		try {
			Method locationJellyBeanFixMethod = Location.class.getMethod("makeComplete");
			if (locationJellyBeanFixMethod != null) {
				locationJellyBeanFixMethod.invoke(mockLocation);
			}
		} catch (Exception e) {
			// TODO: handle exception
		}

		locationManager.setTestProviderLocation(mocLocationProvider, mockLocation);

	}
 
Example 8
Source File: TrackRecordingServiceTest.java    From mytracks with Apache License 2.0 5 votes vote down vote up
/**
 * Inserts a location and waits for 100ms.
 * 
 * @param trackRecordingService the track recording service
 */
private void insertLocation(ITrackRecordingService trackRecordingService)
    throws RemoteException, InterruptedException {
  Location location = new Location("gps");
  location.setLongitude(35.0f);
  location.setLatitude(45.0f);
  location.setAccuracy(5);
  location.setSpeed(10);
  location.setTime(System.currentTimeMillis());
  location.setBearing(3.0f);
  trackRecordingService.insertTrackPoint(location);
  Thread.sleep(200);
}
 
Example 9
Source File: GpsMocker.java    From AutoInteraction-Library with Apache License 2.0 5 votes vote down vote up
private void scheduleMockGps(final Context context) {
    Gps gps;
    synchronized (mMockGps) {
        gps = mMockGps[0];
    }
    if (null == gps) {
        return;
    }
    if (!Macro.RealGps) {
        LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        Location location = new Location(LocationManager.GPS_PROVIDER);
        location.setLatitude(gps.mLatitude);
        location.setLongitude(gps.mLongitude);
        location.setAltitude(0);
        location.setBearing(0);
        location.setSpeed(0);
        location.setAccuracy(2);
        location.setTime(System.currentTimeMillis());
        location.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
        locationManager.setTestProviderLocation(LocationManager.GPS_PROVIDER, location);
    }
    new Handler(context.getMainLooper()).postDelayed(new Runnable() {
        @Override
        public void run() {
            scheduleMockGps(context);
        }
    }, 1000);
}
 
Example 10
Source File: GpsMocker.java    From AutoInteraction-Library with Apache License 2.0 5 votes vote down vote up
private void scheduleMockGps(final Context context) {
    Gps gps;
    synchronized (mMockGps) {
        gps = mMockGps[0];
    }
    if (null == gps) {
        return;
    }
    if (!Macro.RealGps) {
        LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        Location location = new Location(LocationManager.GPS_PROVIDER);
        location.setLatitude(gps.mLatitude);
        location.setLongitude(gps.mLongitude);
        location.setAltitude(0);
        location.setBearing(0);
        location.setSpeed(0);
        location.setAccuracy(2);
        location.setTime(System.currentTimeMillis());
        location.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
        locationManager.setTestProviderLocation(LocationManager.GPS_PROVIDER, location);
    }
    new Handler(context.getMainLooper()).postDelayed(new Runnable() {
        @Override
        public void run() {
            scheduleMockGps(context);
        }
    }, 1000);
}
 
Example 11
Source File: Utils.java    From react-native-appmetrica with MIT License 5 votes vote down vote up
static Location toLocation(ReadableMap locationMap) {
    if (locationMap == null) {
        return null;
    }

    Location location = new Location("Custom");

    if (locationMap.hasKey("latitude")) {
        location.setLatitude(locationMap.getDouble("latitude"));
    }
    if (locationMap.hasKey("longitude")) {
        location.setLongitude(locationMap.getDouble("longitude"));
    }
    if (locationMap.hasKey("altitude")) {
        location.setAltitude(locationMap.getDouble("altitude"));
    }
    if (locationMap.hasKey("accuracy")) {
        location.setAccuracy((float) locationMap.getDouble("accuracy"));
    }
    if (locationMap.hasKey("course")) {
        location.setBearing((float) locationMap.getDouble("course"));
    }
    if (locationMap.hasKey("speed")) {
        location.setSpeed((float) locationMap.getDouble("speed"));
    }
    if (locationMap.hasKey("timestamp")) {
        location.setTime((long) locationMap.getDouble("timestamp"));
    }

    return location;
}
 
Example 12
Source File: RouteFragmentTest.java    From open with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void onLocationChange_shouldStoreSpeedInDatabase() throws Exception {
    initTestFragment();
    TestHelper.startFragment(fragment, act);
    Location testLocation = fragment.getRoute().getGeometry().get(2);
    float expectedSpeed = 44.0f;
    testLocation.setSpeed(expectedSpeed);
    fragment.onLocationChanged(testLocation);
    Cursor cursor = db.query(DatabaseHelper.TABLE_LOCATIONS,
            new String[] { DatabaseHelper.COLUMN_SPEED },
            null, null, null, null, null);
    assertThat(cursor).hasCount(1);
    cursor.moveToNext();
    assertThat(cursor.getFloat(0)).isEqualTo(expectedSpeed);
}
 
Example 13
Source File: MockLocationProvider.java    From FakeTraveler with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Pushes the location in the system (mock). This is where the magic gets done.
 *
 * @param lat latitude
 * @param lon longitude
 * @return Void
 */
public void pushLocation(double lat, double lon) {
    LocationManager lm = (LocationManager) ctx.getSystemService(
            Context.LOCATION_SERVICE);

    Location mockLocation = new Location(providerName);
    mockLocation.setLatitude(lat);
    mockLocation.setLongitude(lon);
    mockLocation.setAltitude(3F);
    mockLocation.setTime(System.currentTimeMillis());
    //mockLocation.setAccuracy(16F);
    mockLocation.setSpeed(0.01F);
    mockLocation.setBearing(1F);
    mockLocation.setAccuracy(3F);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        mockLocation.setBearingAccuracyDegrees(0.1F);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        mockLocation.setVerticalAccuracyMeters(0.1F);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        mockLocation.setSpeedAccuracyMetersPerSecond(0.01F);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        mockLocation.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
    }
    lm.setTestProviderLocation(providerName, mockLocation);
}
 
Example 14
Source File: ContentProviderLocationDAOTest.java    From background-geolocation-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testPersistLocation() {
    LocationDAO dao = new ContentProviderLocationDAO(getContext());

    Location location = new Location("fake");
    location.setAccuracy(200);
    location.setAltitude(900);
    location.setBearing(2);
    location.setLatitude(40.21);
    location.setLongitude(23.45);
    location.setSpeed(20);
    location.setProvider("test");
    location.setTime(1000);
    BackgroundLocation bgLocation = BackgroundLocation.fromLocation(location);

    dao.persistLocation(bgLocation);

    ArrayList<BackgroundLocation> locations = new ArrayList(dao.getAllLocations());
    assertEquals(1, locations.size());

    BackgroundLocation storedLocation = locations.get(0);
    assertEquals(200, storedLocation.getAccuracy(), 0);
    assertEquals(900, storedLocation.getAltitude(), 0);
    assertEquals(2, storedLocation.getBearing(), 0);
    assertEquals(40.21, storedLocation.getLatitude(), 0);
    assertEquals(23.45, storedLocation.getLongitude(), 0);
    assertEquals(20, storedLocation.getSpeed(), 0);
    assertEquals("test", storedLocation.getProvider(), "test");
    assertEquals(1000, storedLocation.getTime(), 0);
    junit.framework.Assert.assertFalse(storedLocation.hasMockLocationsEnabled());
    junit.framework.Assert.assertFalse(storedLocation.areMockLocationsEnabled());
    junit.framework.Assert.assertTrue(storedLocation.hasIsFromMockProvider()); // because setIsFromMockProvider is called in constructor
    junit.framework.Assert.assertFalse(storedLocation.isFromMockProvider());
}
 
Example 15
Source File: AdvancedLocationTest.java    From JayPS-AndroidApp with MIT License 5 votes vote down vote up
@SmallTest
public void testMaxSpeed() throws Exception {
    AdvancedLocation advancedLocation = new AdvancedLocation();

    advancedLocation.setMaxSpeed(13f);
    assertEquals(13f, advancedLocation.getMaxSpeed());

    Location location = new Location("JayPS");
    location.setAccuracy(35);
    location.setSpeed(28f);
    advancedLocation.onLocationChanged(location, 0, 0);

    assertEquals(13f, advancedLocation.getMaxSpeed());

    location.setAccuracy(5);
    location.setSpeed(22f);
    advancedLocation.onLocationChanged(location, 0, 0);

    assertEquals(22f, advancedLocation.getMaxSpeed());

    location.setSpeed(18f);
    advancedLocation.onLocationChanged(location, 0, 0);

    assertEquals(22f, advancedLocation.getMaxSpeed());

    location.setSpeed(45f);
    advancedLocation.onLocationChanged(location, 0, 0);

    assertEquals(45f, advancedLocation.getMaxSpeed());
}
 
Example 16
Source File: LocationServiceTest.java    From background-geolocation-android with Apache License 2.0 4 votes vote down vote up
@Test(timeout = 5000)
public void testOnLocationOnStoppedService() throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(3);
    BroadcastReceiver serviceBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Bundle bundle = intent.getExtras();
            int action = bundle.getInt("action");

            if (action == LocationServiceImpl.MSG_ON_SERVICE_STARTED) {
                latch.countDown();
                mService.stop();
                //mService.onDestroy();
            }
            if (action == LocationServiceImpl.MSG_ON_SERVICE_STOPPED) {
                latch.countDown();
                mService.onLocation(new BackgroundLocation());
            }
            if (action == LocationServiceImpl.MSG_ON_LOCATION) {
                latch.countDown();
            }
        }
    };

    LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(InstrumentationRegistry.getTargetContext());
    lbm.registerReceiver(serviceBroadcastReceiver, new IntentFilter(LocationServiceImpl.ACTION_BROADCAST));

    Config config = Config.getDefault();
    config.setStartForeground(false);

    MockLocationProvider provider = new MockLocationProvider();
    Location location = new Location("gps");
    location.setProvider("mock");
    location.setElapsedRealtimeNanos(2000000000L);
    location.setAltitude(100);
    location.setLatitude(49);
    location.setLongitude(5);
    location.setAccuracy(105);
    location.setSpeed(50);
    location.setBearing(1);

    provider.setMockLocations(Arrays.asList(location));
    mLocationProviderFactory.setProvider(provider);

    mService.setLocationProviderFactory(mLocationProviderFactory);
    mService.configure(config);
    mService.start();

    latch.await();
    lbm.unregisterReceiver(serviceBroadcastReceiver);
}
 
Example 17
Source File: DatabaseHandler.java    From GPSLogger with GNU General Public License v3.0 4 votes vote down vote up
public LocationExtended getLocation(long id) {
    SQLiteDatabase db = this.getWritableDatabase();
    LocationExtended extdloc = null;
    double lcdata_double;
    float lcdata_float;

    Cursor cursor = db.query(TABLE_LOCATIONS, new String[] {KEY_ID,
                    KEY_LOCATION_LATITUDE,
                    KEY_LOCATION_LONGITUDE,
                    KEY_LOCATION_ALTITUDE,
                    KEY_LOCATION_SPEED,
                    KEY_LOCATION_ACCURACY,
                    KEY_LOCATION_BEARING,
                    KEY_LOCATION_TIME,
                    KEY_LOCATION_NUMBEROFSATELLITES,
                    KEY_LOCATION_NUMBEROFSATELLITESUSEDINFIX}, KEY_ID + "=?",
            new String[] { String.valueOf(id) }, null, null, null, null);
    if (cursor != null) {
        cursor.moveToFirst();

        Location lc = new Location("DB");
        lc.setLatitude(cursor.getDouble(1));
        lc.setLongitude(cursor.getDouble(2));

        lcdata_double = cursor.getDouble(3);
        if (lcdata_double != NOT_AVAILABLE) lc.setAltitude(lcdata_double);
        //else lc.removeAltitude();

        lcdata_float = cursor.getFloat(4);
        if (lcdata_float != NOT_AVAILABLE) lc.setSpeed(lcdata_float);
        //else lc.removeSpeed();

        lcdata_float = cursor.getFloat(5);
        if (lcdata_float != NOT_AVAILABLE) lc.setAccuracy(lcdata_float);
        //else lc.removeAccuracy();

        lcdata_float = cursor.getFloat(6);
        if (lcdata_float != NOT_AVAILABLE) lc.setBearing(lcdata_float);
        //else lc.removeBearing();

        lc.setTime(cursor.getLong(7));


        extdloc = new LocationExtended(lc);
        extdloc.setNumberOfSatellites(cursor.getInt(8));
        extdloc.setNumberOfSatellitesUsedInFix(cursor.getInt(9));

        cursor.close();
    }
    return extdloc != null ? extdloc : null;
}
 
Example 18
Source File: LocationService.java    From trekarta with GNU General Public License v3.0 4 votes vote down vote up
public void run() {
    mMockCallback.postDelayed(this, LOCATION_DELAY);
    mMockLocationTicker++;

    // 200 ticks - 60 seconds
    int ddd = mMockLocationTicker % 200;

    // Search for satellites for first 3 seconds and each 1 minute
    if (ddd >= 0 && ddd < 10) {
        mGpsStatus = GPS_SEARCHING;
        mFSats = mMockLocationTicker % 10;
        mTSats = 25;
        mContinuous = false;
        updateGpsStatus();
        return;
    }

    if (mGpsStatus == GPS_SEARCHING) {
        mGpsStatus = GPS_OK;
        updateGpsStatus();
    }

    mLastKnownLocation = new Location(LocationManager.GPS_PROVIDER);
    mLastKnownLocation.setTime(System.currentTimeMillis());
    mLastKnownLocation.setAccuracy(3 + mMockLocationTicker % 100);
    mLastKnownLocation.setSpeed(20);
    mLastKnownLocation.setAltitude(20 + mMockLocationTicker);
    //mLastKnownLocation.setLatitude(34.865792);
    //mLastKnownLocation.setLongitude(32.351646);
    //mLastKnownLocation.setBearing((System.currentTimeMillis() / 166) % 360);
    //mLastKnownLocation.setAltitude(169);
    /*
    double lat = 55.813557;
    double lon = 37.645524;
    if (ddd < 50) {
        lat += ddd * 0.0001;
        mLastKnownLocation.setBearing(0);
    } else if (ddd < 100) {
        lat += 0.005;
        lon += (ddd - 50) * 0.0001;
        mLastKnownLocation.setBearing(90);
    } else if (ddd < 150) {
        lat += (150 - ddd) * 0.0001;
        lon += 0.005;
        mLastKnownLocation.setBearing(180);
    } else {
        lon += (200 - ddd) * 0.0001;
        mLastKnownLocation.setBearing(270);
    }
    */
    double lat = 60.0 + mMockLocationTicker * 0.0001;
    double lon = 30.3;
    if (ddd < 10) {
        mLastKnownLocation.setBearing(ddd);
    }
    if (ddd < 90) {
        mLastKnownLocation.setBearing(10);
    } else if (ddd < 110) {
        mLastKnownLocation.setBearing(100 - ddd);
    } else if (ddd < 190) {
        mLastKnownLocation.setBearing(-10);
    } else {
        mLastKnownLocation.setBearing(-200 + ddd);
    }
    mLastKnownLocation.setLatitude(lat);
    mLastKnownLocation.setLongitude(lon);
    mNmeaGeoidHeight = 0;

    updateLocation();
    mContinuous = true;
}
 
Example 19
Source File: AbstractFileTrackImporter.java    From mytracks with Apache License 2.0 4 votes vote down vote up
/**
 * Gets a track point.
 */
protected Location getTrackPoint() throws SAXException {
  Location location = createLocation();

  // Calculate derived attributes from the previous point
  if (trackData.lastLocationInCurrentSegment != null
      && trackData.lastLocationInCurrentSegment.getTime() != 0) {
    long timeDifference = location.getTime() - trackData.lastLocationInCurrentSegment.getTime();

    // Check for negative time change
    if (timeDifference <= 0) {
      Log.w(TAG, "Time difference not postive.");
    } else {

      /*
       * We don't have a speed and bearing in GPX, make something up from the
       * last two points. GPS points tend to have some inherent imprecision,
       * speed and bearing will likely be off, so the statistics for things
       * like max speed will also be off.
       */        
      double duration = timeDifference * UnitConversions.MS_TO_S;
      double speed = trackData.lastLocationInCurrentSegment.distanceTo(location) / duration;
      location.setSpeed((float) speed);
    }
    location.setBearing(trackData.lastLocationInCurrentSegment.bearingTo(location));
  }

  if (!LocationUtils.isValidLocation(location)) {
    throw new SAXException(createErrorMessage("Invalid location detected: " + location));
  }

  if (trackData.numberOfSegments > 1 && trackData.lastLocationInCurrentSegment == null) {
    /*
     * If not the first segment, add a resume separator before adding the
     * first location.
     */
    insertLocation(
        createLocation(TrackRecordingService.RESUME_LATITUDE, 0.0, 0.0, location.getTime()));
  }
  trackData.lastLocationInCurrentSegment = location;
  return location;
}
 
Example 20
Source File: DatabaseHandler.java    From GPSLogger with GNU General Public License v3.0 4 votes vote down vote up
public List<LocationExtended> getPlacemarksList(long TrackID, long startNumber, long endNumber) {

        List<LocationExtended> placemarkList = new ArrayList<>();

        String selectQuery = "SELECT  * FROM " + TABLE_PLACEMARKS + " WHERE "
                + KEY_TRACK_ID + " = " + TrackID + " AND "
                + KEY_LOCATION_NUMBER + " BETWEEN " + startNumber + " AND " + endNumber
                + " ORDER BY " + KEY_LOCATION_NUMBER;

        //Log.w("myApp", "[#] DatabaseHandler.java - getLocationList(" + TrackID + ", " + startNumber + ", " +endNumber + ") ==> " + selectQuery);

        SQLiteDatabase db = this.getWritableDatabase();
        Cursor cursor = db.rawQuery(selectQuery, null);
        double lcdata_double;
        float lcdata_float;

        if (cursor != null) {
            // looping through all rows and adding to list
            if (cursor.moveToFirst()) {
                do {
                    Location lc = new Location("DB");
                    lc.setLatitude(cursor.getDouble(3));
                    lc.setLongitude(cursor.getDouble(4));

                    lcdata_double = cursor.getDouble(5);
                    if (lcdata_double != NOT_AVAILABLE) lc.setAltitude(lcdata_double);
                    //else lc.removeAltitude();

                    lcdata_float = cursor.getFloat(6);
                    if (lcdata_float != NOT_AVAILABLE) lc.setSpeed(lcdata_float);
                    //else lc.removeSpeed();

                    lcdata_float = cursor.getFloat(7);
                    if (lcdata_float != NOT_AVAILABLE) lc.setAccuracy(lcdata_float);
                    //else lc.removeAccuracy();

                    lcdata_float = cursor.getFloat(8);
                    if (lcdata_float != NOT_AVAILABLE) lc.setBearing(lcdata_float);
                    //else lc.removeBearing();

                    lc.setTime(cursor.getLong(9));

                    LocationExtended extdloc = new LocationExtended(lc);
                    extdloc.setNumberOfSatellites(cursor.getInt(10));
                    extdloc.setNumberOfSatellitesUsedInFix(cursor.getInt(13));
                    extdloc.setDescription(cursor.getString(12));

                    placemarkList.add(extdloc); // Add Location to list
                } while (cursor.moveToNext());
            }
            cursor.close();
        }
        return placemarkList;
    }