blob: 070815b6cc91013075650b959c2372f0e8e7829f [file] [log] [blame]
Soonil Nagarkar574c2bf2021-05-19 17:15:23 -07001/*
2 * Copyright 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package androidx.core.location;
18
Alan Viverette553710d2022-01-14 14:09:34 -050019import android.location.Location;
Soonil Nagarkar574c2bf2021-05-19 17:15:23 -070020import android.location.LocationListener;
21import android.os.Bundle;
22
23import androidx.annotation.NonNull;
24import androidx.annotation.Nullable;
25
Alan Viverette553710d2022-01-14 14:09:34 -050026import java.util.List;
27
Soonil Nagarkar574c2bf2021-05-19 17:15:23 -070028/**
29 * A version of {@link LocationListener} suitable for use on all API levels.
30 */
31public interface LocationListenerCompat extends LocationListener {
32
33 @Override
34 default void onStatusChanged(@NonNull String provider, int status, @Nullable Bundle extras) {}
35
36 @Override
37 default void onProviderEnabled(@NonNull String provider) {}
38
39 @Override
40 default void onProviderDisabled(@NonNull String provider) {}
Alan Viverette553710d2022-01-14 14:09:34 -050041
42 @Override
43 default void onLocationChanged(@NonNull List<Location> locations) {
44 final int size = locations.size();
45 for (int i = 0; i < size; i++) {
46 onLocationChanged(locations.get(i));
47 }
48 }
49
50 @Override
51 default void onFlushComplete(int requestCode) {}
Soonil Nagarkar574c2bf2021-05-19 17:15:23 -070052}