ims.map
Class DeviceLocationListener
java.lang.Object
ims.map.DeviceLocationListener
- All Implemented Interfaces:
- java.lang.Runnable
public class DeviceLocationListener
- extends java.lang.Object
- implements java.lang.Runnable
Runnable which handles location changes of the device's location.
Copyright © 2014 by Daniela Blum
This file is part of GPSChildFinder.
GPSChildFinder is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program. If not, see http://www.gnu.org/licenses.
- Author:
- Daniela Blum
Method Summary |
void |
run()
Gets called from Map class and is running after the
specified amount of time elapses which is set by its handler. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DeviceLocationListener
public DeviceLocationListener(Map map,
android.content.Context context)
- Constructor.
- Parameters:
map
- Map class in which the main components of the map and the
ims.map.Map#deviceHandler
are located.context
- map's and locationListener's context
run
public void run()
- Gets called from
Map
class and is running after the
specified amount of time elapses which is set by its handler. Executes
the active part of the class.
First it gets checked whether a device is connected to the phone and GPS
input is received from it or not.
If a device is connected and GPS input is received, the
Map.deviceLocationButton
is set up and the GPS
coordinates are requested from the
BluetoothDataManager
. The marker options for
the device's location are set up, so that the marker can be shown on the
map's screen (Map.showDeviceLocation(android.view.View)
).
If the direction (Map.showDirection
) should be shown, the
Map.showDirection()
method is called.
If no device is connected or no GPS input is received, the location
marker is removed from the map's screen and the
Map.deviceLocationButton
is set disabled. A toast with
informations for the user is shown as well.
- Specified by:
run
in interface java.lang.Runnable