Home | History | Annotate | Download | only in location
      1 /*
      2  * Copyright (C) 2013 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.hardware.location;
     18 
     19 import android.location.Location;
     20 
     21 /**
     22  * The callback class associated with the APIs in {@link GeofenceHardware}
     23  */
     24 public abstract class GeofenceHardwareCallback {
     25     /**
     26      * The callback called when there is a transition to report for the specific
     27      * geofence.
     28      *
     29      * @param geofenceId The geofence ID of the geofence
     30      * @param transition One of {@link GeofenceHardware#GEOFENCE_ENTERED},
     31      *        {@link GeofenceHardware#GEOFENCE_EXITED}, {@link GeofenceHardware#GEOFENCE_UNCERTAIN}
     32      * @param location The last known location according to the monitoring system.
     33      * @param timestamp The timestamp (elapsed real time in milliseconds) when the transition was
     34      *        detected
     35      * @param monitoringType Type of the monitoring system.
     36      */
     37     public void onGeofenceTransition(int geofenceId, int transition, Location location,
     38             long timestamp, int monitoringType) {
     39     }
     40 
     41     /**
     42      * The callback called to notify the success or failure of the add call.
     43      *
     44      * @param geofenceId The ID of the geofence.
     45      * @param status One of {@link GeofenceHardware#GEOFENCE_SUCCESS},
     46      *        {@link GeofenceHardware#GEOFENCE_ERROR_ID_EXISTS},
     47      *        {@link GeofenceHardware#GEOFENCE_ERROR_INVALID_TRANSITION},
     48      *        {@link GeofenceHardware#GEOFENCE_ERROR_TOO_MANY_GEOFENCES},
     49      *        {@link GeofenceHardware#GEOFENCE_FAILURE}
     50      */
     51     public void onGeofenceAdd(int geofenceId, int status) {
     52     }
     53 
     54     /**
     55      * The callback called to notify the success or failure of the remove call.
     56      *
     57      * @param geofenceId The ID of the geofence.
     58      * @param status  One of {@link GeofenceHardware#GEOFENCE_SUCCESS},
     59      *        {@link GeofenceHardware#GEOFENCE_ERROR_ID_UNKNOWN},
     60      *        {@link GeofenceHardware#GEOFENCE_FAILURE}
     61      */
     62     public void onGeofenceRemove(int geofenceId, int status) {
     63     }
     64 
     65     /**
     66      * The callback called to notify the success or failure of the pause call.
     67      *
     68      * @param geofenceId The ID of the geofence.
     69      * @param status One of {@link GeofenceHardware#GEOFENCE_SUCCESS},
     70      *        {@link GeofenceHardware#GEOFENCE_ERROR_ID_UNKNOWN},
     71      *        {@link GeofenceHardware#GEOFENCE_FAILURE}
     72      */
     73     public void onGeofencePause(int geofenceId, int status) {
     74     }
     75 
     76     /**
     77      * The callback called to notify the success or failure of the resume call.
     78      *
     79      * @param geofenceId The ID of the geofence.
     80      * @param status One of {@link GeofenceHardware#GEOFENCE_SUCCESS},
     81      *        {@link GeofenceHardware#GEOFENCE_ERROR_ID_UNKNOWN},
     82      *        {@link GeofenceHardware#GEOFENCE_ERROR_INVALID_TRANSITION},
     83      *        {@link GeofenceHardware#GEOFENCE_FAILURE}
     84      */
     85     public void onGeofenceResume(int geofenceId, int status) {
     86     }
     87 }
     88