Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
libs
src
.gitignore
README.md
build.gradle
pathsense-invehiclelocationdemo-app.iml
proguard-rules.pro

README.md

Setup for Pathsense In-Vehicle Location Demo

  1. Obtain a Google Maps Android API Key from here.

  2. Obtain a Pathsense SDK Client ID and API Key from here. Click “GET STARTED” and enter your email address.

  3. In AndroidManifest.xml, add the following elements as children of the <application> element, by inserting them just before the closing </application> tag:

    <meta-data 
      android:name="com.google.android.maps.v2.API_KEY" 
      android:value="YOUR_GOOGLE_MAPS_API_KEY" />
          
    <meta-data 
      android:name="com.pathsense.android.sdk.CLIENT_ID" 
      android:value="YOUR_PATHSENSE_SDK_CLIENT_ID" />
    
    <meta-data 
      android:name="com.pathsense.android.sdk.API_KEY" 
      android:value="YOUR_PATHSENSE_SDK_API_KEY" />
    • Substitute your API_KEY key for YOUR_GOOGLE_MAPS_API_KEY in the value attribute. This element sets the key com.google.android.maps.v2.API_KEY to the value of your Google Maps Android API key.

    • Substitute your CLIENT_ID key for YOUR_PATHSENSE_SDK_CLIENT_ID in the value attribute. This element sets the key com.pathsense.android.sdk.CLIENT_ID to the value of your Pathsense SDK Client ID.

    • Substitute your API_KEY key for YOUR_PATHSENSE_SDK_API_KEY in the value attribute. This element sets the key com.pathsense.android.sdk.API_KEY to the value of your Pathsense SDK API key.

  4. Save AndroidManifest.xml.

  5. Place pathsense-android-sdk-location-bundle-release-4.0.0.2.aar under /libs

  6. In build.gradle, add the following:

    • to the repositories element:
    repositories {
      flatDir {
        dirs 'libs'
      }
    }
    • to the dependencies element:
    compile(name:'pathsense-android-sdk-location-bundle-release-4.0.0.2', ext:'aar')
    • for improved performance on Android Oreo and above add Google Play Services Location 15.0.1 or higher *not required
    compile "com.google.android.gms:play-services-location:15.0.1"
  7. Save build.gradle.

  8. Re-build application.

Requesting In-Vehicle Location Updates

  1. Create a Broadcast Receiver that will receive in-vehicle location updates.

    public class PathsenseInVehicleLocationDemoInVehicleLocationUpdateReceiver extends BroadcastReceiver
    {
      @Override
      public void onReceive(Context context, Intent intent)
      {  
        PathsenseInVehicleLocation inVehicleLocation = PathsenseInVehicleLocation.fromIntent(intent);
        if (inVehicleLocation != null)
        {
          // do something
        }
      }
    }
  2. In AndroidManifest.xml, add the following element as a child of the <application> element, by inserting it just before the closing </application> tag:

    <receiver  
      android:name=".PathsenseInVehicleLocationDemoInVehicleLocationUpdateReceiver" />
  3. In MapActivity (or any other context object), instantiate the PathsenseLocationProviderApi:

    PathsenseLocationProviderApi api = PathsenseLocationProviderApi.getInstance(context);
  4. Request in-vehicle location updates by calling requestInVehicleLocationUpdates with the receiver created in step #1:

    api.requestInVehicleLocationUpdates(PathsenseInVehicleLocationDemoInVehicleLocationUpdateReceiver.class);
You can’t perform that action at this time.