1 /* 2 * Copyright (C) 2012 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 com.android.location.provider; 18 19 import android.location.LocationRequest; 20 import android.location.LocationRequest.Quality; 21 22 /** 23 * This class is an interface to LocationRequests for unbundled applications. 24 * 25 * <p>IMPORTANT: This class is effectively a public API for unbundled 26 * applications, and must remain API stable. See README.txt in the root 27 * of this package for more information. 28 * 29 * @deprecated Do not use. 30 */ 31 @Deprecated 32 public final class LocationRequestUnbundled { 33 34 /** 35 * @deprecated Use {@link LocationRequest#QUALITY_HIGH_ACCURACY} instead. 36 */ 37 @Deprecated 38 public static final int ACCURACY_FINE = LocationRequest.ACCURACY_FINE; 39 40 /** 41 * @deprecated Use {@link LocationRequest#QUALITY_BALANCED_POWER_ACCURACY} instead. 42 */ 43 @Deprecated 44 public static final int ACCURACY_BLOCK = LocationRequest.ACCURACY_BLOCK; 45 46 47 /** 48 * @deprecated Use {@link LocationRequest#QUALITY_LOW_POWER} instead. 49 */ 50 @Deprecated 51 public static final int ACCURACY_CITY = LocationRequest.ACCURACY_CITY; 52 53 54 /** 55 * @deprecated Do not use. 56 */ 57 @Deprecated 58 public static final int POWER_NONE = LocationRequest.POWER_NONE; 59 60 61 /** 62 * @deprecated Use {@link LocationRequest#QUALITY_LOW_POWER} instead. 63 */ 64 @Deprecated 65 public static final int POWER_LOW = LocationRequest.POWER_LOW; 66 67 68 /** 69 * @deprecated Use {@link LocationRequest#QUALITY_BALANCED_POWER_ACCURACY} instead. 70 */ 71 @Deprecated 72 public static final int POWER_HIGH = LocationRequest.POWER_HIGH; 73 74 private final LocationRequest delegate; 75 LocationRequestUnbundled(LocationRequest delegate)76 LocationRequestUnbundled(LocationRequest delegate) { 77 this.delegate = delegate; 78 } 79 80 /** 81 * Get the location update interval. 82 * 83 * @return location update interval 84 */ getInterval()85 public long getInterval() { 86 return delegate.getIntervalMillis(); 87 } 88 89 /** 90 * Get the minimum delivery interval. 91 * 92 * @return minimum delivery interval 93 */ getFastestInterval()94 public long getFastestInterval() { 95 return delegate.getMinUpdateIntervalMillis(); 96 } 97 98 /** 99 * Get the quality of the request. 100 * 101 * @return a {@link LocationRequest} QUALITY_* constant 102 */ getQuality()103 public @Quality int getQuality() { 104 return delegate.getQuality(); 105 } 106 107 /** 108 * Get the minimum distance between location updates, in meters. 109 * 110 * @return minimum distance between location updates in meters 111 */ getSmallestDisplacement()112 public float getSmallestDisplacement() { 113 return delegate.getMinUpdateDistanceMeters(); 114 } 115 116 /** 117 * Returns true if location settings will be ignored in order to satisfy this request. 118 * 119 * @return true if location settings will be ignored in order to satisfy this request 120 */ isLocationSettingsIgnored()121 public boolean isLocationSettingsIgnored() { 122 return delegate.isLocationSettingsIgnored(); 123 } 124 125 @Override toString()126 public String toString() { 127 return delegate.toString(); 128 } 129 } 130