Skip to main content

Install SDK on Flutter

GitHub Pub Version

Add Hypertrack SDK

Add following lines to your applications pubspec.yml:

dependencies:
hypertrack_plugin: <version>
note

We constantly work on making our SDKs better, so make sure you have the latest version. You can get it in changelog here.

Import Hypertrack SDK

Import the SDK in the main.dart file of your project

import 'package:hypertrack_plugin/hypertrack.dart';

Install Hypertrack SDK

Install the SDK using the following command:

$ flutter pub get

Alternatively, the code editor might support flutter pub get. Check the editor docs for your editor to learn more.

Initialize SDK

Obtain an SDK instance, when you wish to use SDK, by passing your publishable key from the Setup page.

  HyperTrack sdk = await HyperTrack.initialize("your-publishable-key-here");

HyperTrack accesses location and activity data, you may use HyperTrack.requestPermissionsIfNecessary() convenience method to request permissions and make the SDK integration simpler.

Identify your devices

HyperTrack uses string device identifiers that could be obtained from the SDK instance

   String deviceId = await sdk.getDeviceId();

Make sure you've saved this device identifier as it is required when calling HyperTrack Devices and Trips APIs.

Give your device a name

A device can be tagged with a custom name

   sdk.setDeviceName("device-name-here");

Set up silent push notifications

The SDK has a bi-directional communication model with the server. This enables the SDK to run on a variable frequency model, which balances the fine trade-off between low latency tracking and battery efficiency, and improves robustness. This also enables HyperTrack Trips to start and stop tracking automatically when trip starts and ends. For this purpose, the iOS SDK uses APNs silent remote notifications and Android SDK uses FCM silent notifications.

Prepare for App Store and Play Market submission

Read the Prepare for App Store submission section of iOS SDK guide and Get approved for the background location access section of Android SDK guide.

You are all set

Once your app is running, go to the dashboard where you can see a list of all your devices and their live location with ongoing activity on the map.

SDK integration examples

To learn more about SDK integration examples, you may visit these resources:

Frequently Asked Questions

Support

Join our Slack community for instant responses. You can also email us at help@hypertrack.com.