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