• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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.example.android.wearable.geofencing;
18 
19 import android.net.Uri;
20 
21 import com.google.android.gms.location.Geofence;
22 
23 /** Constants used in companion app. */
24 public final class Constants {
25 
Constants()26     private Constants() {
27     }
28 
29     public static final String TAG = "ExampleGeofencingApp";
30 
31     // Request code to attempt to resolve Google Play services connection failures.
32     public final static int CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000;
33     // Timeout for making a connection to GoogleApiClient (in milliseconds).
34     public static final long CONNECTION_TIME_OUT_MS = 100;
35 
36     // For the purposes of this demo, the geofences are hard-coded and should not expire.
37     // An app with dynamically-created geofences would want to include a reasonable expiration time.
38     public static final long GEOFENCE_EXPIRATION_TIME = Geofence.NEVER_EXPIRE;
39 
40     // Geofence parameters for the Android building on Google's main campus in Mountain View.
41     public static final String ANDROID_BUILDING_ID = "1";
42     public static final double ANDROID_BUILDING_LATITUDE = 37.420092;
43     public static final double ANDROID_BUILDING_LONGITUDE = -122.083648;
44     public static final float ANDROID_BUILDING_RADIUS_METERS = 60.0f;
45 
46     // Geofence parameters for the Yerba Buena Gardens near the Moscone Center in San Francisco.
47     public static final String YERBA_BUENA_ID = "2";
48     public static final double YERBA_BUENA_LATITUDE = 37.784886;
49     public static final double YERBA_BUENA_LONGITUDE = -122.402671;
50     public static final float YERBA_BUENA_RADIUS_METERS = 72.0f;
51 
52 
53     // The constants below are less interesting than those above.
54 
55     // Path for the DataItem containing the last geofence id entered.
56     public static final String GEOFENCE_DATA_ITEM_PATH = "/geofenceid";
57     public static final Uri GEOFENCE_DATA_ITEM_URI =
58             new Uri.Builder().scheme("wear").path(GEOFENCE_DATA_ITEM_PATH).build();
59     public static final String KEY_GEOFENCE_ID = "geofence_id";
60 
61     // Keys for flattened geofences stored in SharedPreferences.
62     public static final String KEY_LATITUDE = "com.example.wearable.geofencing.KEY_LATITUDE";
63     public static final String KEY_LONGITUDE = "com.example.wearable.geofencing.KEY_LONGITUDE";
64     public static final String KEY_RADIUS = "com.example.wearable.geofencing.KEY_RADIUS";
65     public static final String KEY_EXPIRATION_DURATION =
66             "com.example.wearable.geofencing.KEY_EXPIRATION_DURATION";
67     public static final String KEY_TRANSITION_TYPE =
68             "com.example.wearable.geofencing.KEY_TRANSITION_TYPE";
69     // The prefix for flattened geofence keys.
70     public static final String KEY_PREFIX = "com.example.wearable.geofencing.KEY";
71 
72     // Invalid values, used to test geofence storage when retrieving geofences.
73     public static final long INVALID_LONG_VALUE = -999l;
74     public static final float INVALID_FLOAT_VALUE = -999.0f;
75     public static final int INVALID_INT_VALUE = -999;
76 
77 }
78