Can I use in onConnected
from multiple onLocationChanged
? for example first onLocationChanged
for update location user and second onLocationChanged
for other works :
@Override
public void onConnected(@Nullable Bundle bundle) {
LocationListener mListenerone = new LocationListener() {
@Override
public void onLocationChanged(final Location location) {
}
};
LocationRequest requestone = LocationRequest.create();
requestone.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
requestone.setInterval(100);
requestone.setFastestInterval(100);
LocationServices.FusedLocationApi.requestLocationUpdates(mLocationClient, requestone, mListenerone);
LocationListener mListenertwo = new LocationListener() {
@Override
public void onLocationChanged(final Location location) {
}
};
LocationRequest requesttwo = LocationRequest.create();
requesttwo.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
requesttwo.setInterval(10000);
requesttwo.setFastestInterval(1000);
LocationServices.FusedLocationApi.requestLocationUpdates(mLocationClient, requesttwo, mListenertwo);
}