compileSdkVersion 25
applicationId "com.google.android.example.basicawarenesssample"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-awareness:11.4.0'
package com.google.android.example.basicawarenesssample
uses-permission
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Sample application which sets up a few context fences using the Awareness API, and takes "snapshots" of data about the user and the device's surroundings. * NOTE: for this sample to work, you need to add an API key in the manifest. See https://developers.google.com/awareness/android-api/get-a-key for instructions.
Uses the snapshot API to print out some contextual information the device is "aware" of.
Helper method to retrieve weather data using the Snapshot API. Since Weather is protected by a runtime permission, this snapshot code is going to be called in multiple places: {@link #printSnapshot()} when the permission has already been accepted, and {@link #onRequestPermissionsResult(int, String[], int[])} when the permission is requested and has been granted.
Helper method to handle requesting the runtime permissions required for weather snapshots. * @return true if the permission has already been granted, false otherwise.
Sets up {@link AwarenessFence}'s for the sample app, and registers callbacks for them with a custom {@link BroadcastReceiver}
A basic BroadcastReceiver to handle intents from from the Awareness API.