Initializing Kruzr & Trip Monitoring

You are now set to Initialize Kruzr's SDK and its Trip Monitoring Object. Please note that initialization should be done in the Application Class of your project. All your interactions with the Kruzr SDK will happen through an instance of class Kruzr.

Initializing Kruzr SDK

To initialise the Kruzr SDK, you will need to call Kruzr’s init method within Application Class with the following parameters:

  • application object

  • YOUR_LICENSE_KEY

Kruzr.getInstance().init(this, "YOUR_LICENSE_KEY");

Initializing Kruzr TripMonitoring

In order to start monitoring trips, you need to create an object for initiateTripMonitoring

Before we get to example of initiating TripMonitoring service, there are some important permission related factors to keep in mind on your app front to ensure TripMonitoring works properly (i.e. it is able to detect trips automatically):

  • On API Levels 23 and above: Make sure you ask user forManifest.permission.ACCESS_FINE_LOCATION

  • On API Levels 29 and above: Make sure you ask user for Manifest.permission.ACTIVITY_RECOGNITION

Once permission is given, call the below function to enable Automatic Trip Detection:

Kruzr.getInstance().initiateTripMonitoring(Context context);

Once you have created instance of Kruzr SDK and set-up trip monitoring, you are now ready to register your user with Kruzr SDK and our back-end. Please continue to next section to set-up your first user!

Enabling/Disabling Auto trip start

Kruzr.getInstance().shouldTripAutoStart(Context context, boolean shouldTripAutoStart)

You can check the current status of auto trip start through this method

Kruzr.getInstance().isTripAutoStartEnabled(Context context)

Enabling/Disabling Auto trip end

Kruzr.getInstance().shouldTripAutoEnd(Context context, boolean shouldTripAutoEnd)

You can check the current status of auto trip end through this method

Kruzr.getInstance().isTripAutoEndEnabled(Context context)

Last updated

Was this helpful?