Courtesy: GitHub
Warning: file_get_contents(../git/googlesamples/android-play-awareness/basic-awareness-sample/ failed to open stream: No such file or directory in /var/www/ on line 10

compileSdkVersion 25

applicationId ""

minSdkVersion 14

targetSdkVersion 25

versionCode 1

versionName "1.0"

compile fileTree(dir: 'libs', include: ['*.jar'])

compile ''

compile ''

compile ''

compile ''



  • android.permission.ACCESS_FINE_LOCATION


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

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 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.