Skip to content
This repository was archived by the owner on Apr 23, 2023. It is now read-only.
This repository was archived by the owner on Apr 23, 2023. It is now read-only.

onLocationChanged is called from a LocationRequest of another fragment #142

@westnordost

Description

@westnordost

Description

Not sure if this is expected behavior (=mirroring google play api) or a bug. In any case, it would be good if this was documented:
Requesting different location updates from different places will make the onLocationChanged method be called in both places whenever the condition of either location request of any of the two places is fulfilled.

Steps to Reproduce

I have an activity which requests location updates only every few minutes and only if the user moved quite a bit.

LocationRequest request = LocationRequest.create()
		.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
		.setSmallestDisplacement(500)
		.setInterval(3*60*1000); // 3 minutes

LocationServices.FusedLocationApi.requestLocationUpdates(lostApiClient, request, this);

Then, I also got a fragment, which creates an own lostApiClient for itself (which I guess points to the same object internally) and requests very frequent location updates, let's say every second.

As soon as that fragment starts requesting location updates, the former mentioned activity starts to get calls every second to onLocationChanged.
The activity is doing an expensive operation on onLocationChanged, I expected that the parameters of my location request would be respected.

Lost & Android Version

2.1.1 on Android 5.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions