Using TripDetector.AWARENESS

Follow this guide to use the TripDetector.AWARENESS feature

Enable Google Awareness API

  1. Create or use an existing project in https://console.cloud.google.com/

  2. Navigate to "APIs and Services" by either using the search in Google Cloud Services or by using this link: https://console.cloud.google.com/apis/dashboard

  3. Select "Enable APIs and Services" then search for and select "Awareness API". (https://console.cloud.google.com/apis/library/usercontext.googleapis.com)

  4. Select "Enable" and wait until the process has finished

  5. Now that the API has been enabled, lets get a key to use in the app.

    1. Select the "Credentials" tab

    2. Click "Create Credentials" -> "API key". This will generate an unrestricted key.

    3. In the dialog with the key showing, select "Edit API key"

    4. Set the application restriction to "Android Apps"

    5. Under Android Restrictions click "Add"

    6. Follow the instructions on the screen to add your app's fingerprint to the restrictions

Add Awareness API to Manifest

Add the following to your app's manifest and replace "API_KEY" with the key generated using the above instructions

<manifest>
    <application>
        <meta-data
            android:name="com.google.android.awareness.API_KEY"
            android:value="API_KEY"/>
    </application>
</manifest>

Add Feature to IMSTripManager

When adding TripDetectors, include the TripDetector.AWARENESS feature

 .addTripDetectors(TripDetector.AWARENESS, ...)

Last updated