首页 > 解决方案 > Why we have to remove location listener in FusedLocationProviderClient?

问题描述

I had a problem in which the location callback wasn't refreshing. So I added mFusedLocationProviderClient.removeLocationUpdates().

Why do we have to remove the location callback? Shouldn't It update itself whenever I move to a new location?

In the docs it stated this as:

This call will keep the Google Play services connection active, so make sure to call removeLocationUpdates(LocationCallback) when you no longer need it, otherwise you lose the benefits of the automatic connection management.

Can someone explain this?

标签: fusedlocationproviderclient

解决方案


推荐阅读