geolocation - FusedLocationProviderClient With Service Android Kotlin -


i using fused api location update. using fused api activity working fine. when use within service class showing this service class code . error occurring

class task (https://developers.google.com/android/reference/com/google/android/gms/tasks/task) have 3 overloads of method addoncompletelistener:

  • addoncompletelistener(oncompletelistener<tresult> listener)
  • addoncompletelistener(activity activity, oncompletelistener<tresult> listener)
  • addoncompletelistener(executor executor, oncompletelistener<tresult> listener)

your service neither activity, nor executor. 2 latter overloads not applicable you. drop first parameter , use that:

mfusedlocationclient!!.lastlocation.addoncompletelistener { task -> //do }


Comments

Popular posts from this blog

html - How to custom Bootstrap grid height? -

javascript - pass values from mssql to views in node -

javascript - Understanding ExtJS Framework Syntax -