• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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 
17 package android.location;
18 
19 import android.os.Bundle;
20 
21 /**
22  * Used for receiving notifications from the LocationManager when
23  * the location has changed. These methods are called if the
24  * LocationListener has been registered with the location manager service
25  * using the {@link LocationManager#requestLocationUpdates(String, long, float, LocationListener)}
26  * method.
27  *
28  * <div class="special reference">
29  * <h3>Developer Guides</h3>
30  * <p>For more information about identifying user location, read the
31  * <a href="{@docRoot}guide/topics/location/obtaining-user-location.html">Obtaining User
32  * Location</a> developer guide.</p>
33  * </div>
34  */
35 public interface LocationListener {
36 
37     /**
38      * Called when the location has changed.
39      *
40      * <p> There are no restrictions on the use of the supplied Location object.
41      *
42      * @param location The new location, as a Location object.
43      */
onLocationChanged(Location location)44     void onLocationChanged(Location location);
45 
46     /**
47      * This callback will never be invoked and providers can be considers as always in the
48      * {@link LocationProvider#AVAILABLE} state.
49      *
50      * @deprecated This callback will never be invoked.
51      */
52     @Deprecated
onStatusChanged(String provider, int status, Bundle extras)53     void onStatusChanged(String provider, int status, Bundle extras);
54 
55     /**
56      * Called when the provider is enabled by the user.
57      *
58      * @param provider the name of the location provider associated with this
59      * update.
60      */
onProviderEnabled(String provider)61     void onProviderEnabled(String provider);
62 
63     /**
64      * Called when the provider is disabled by the user. If requestLocationUpdates
65      * is called on an already disabled provider, this method is called
66      * immediately.
67      *
68      * @param provider the name of the location provider associated with this
69      * update.
70      */
onProviderDisabled(String provider)71     void onProviderDisabled(String provider);
72 }
73