- Details
- Written by: Stanko Milosev
- Category: Downloads
- Hits: 15482
Example of client application for IBM WebSphere MQ.
Exe and source code (Delphi 2009)
- Details
- Written by: Stanko Milosev
- Category: Android
- Hits: 242
val locationManager = getSystemService(LOCATION_SERVICE) as LocationManager
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
1000L,
0f
) { location ->
logger.log("\nLat: " + location.latitude.toString()
+ "\nLon: " + location.longitude.toString()
+ "\nAltitude" + location.altitude.toString())
}
but in order to be able to stop requests, declare lamba like function type:
private lateinit var gpsListener: LocationListener
...
gpsListener = LocationListener { location ->
logger.log(
"\nLat: " + location.latitude.toString()
+ "\nLon: " + location.longitude.toString()
+ "\nAltitude" + location.altitude.toString()
)
}
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
1000L,
0f,
gpsListener
)
Stop it like this:
locationManager.removeUpdates(gpsListener)Example download from here.