Guest User

Untitled

a guest
Apr 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. class MainActivity: AppCompat {
  2. fun startGeoUpdates(callback: (Location) -> Unit) {
  3. val params = LocationParams.Builder().setInterval(5).setDistance(10f).setAccuracy(LocationAccuracy.HIGH).build()
  4. SmartLocation.with(context).location().config(params).continuous().start { location ->
  5. if (location != null) callback(location)
  6. }
  7. }
  8.  
  9. fun seuMetodo() {
  10. // ...
  11. startGeoUpdates {
  12. Log.i("GPSLocations",
  13. "Lat: " + it.getLatitude()
  14. + "\nLng: " + it.getLongitude()
  15. + "\n Acc: " + it.getAccuracy())
  16. }
  17. }
  18. }
Add Comment
Please, Sign In to add comment