IMS SDK Product Document
  • Getting Started
    • iOS
      • Requirements
      • Importing the SDK
      • Permissions
      • Initializing the SDK
      • Using the SDK
        • Using Push Notifications
          • Push notification certificate and profile creation guide
    • Android
      • Requirements
      • Import the SDK
      • Permissions
      • Obfuscation
      • Initialize the SDK
      • Using the SDK
        • Trip Detection and Recording
          • Trip Manager Configuration
            • Using TripDetector.AWARENESS
            • Trip Manager Device Support
          • Trip Manager Control
          • Trip Manager Status
        • Bluetooth and Other Devices
    • React Native
      • Requirements
      • Import the SDK
      • Permissions
      • Initialize the SDK
        • Android
        • iOS
      • Using the SDK
        • Trip Manager
        • Device service
    • Flutter
      • Requirements
      • Import the SDK
      • Permissions
      • Initialize the SDK
      • Using the SDK
  • Security
  • App misuse
  • Time Driven Without Phone
  • DriveSync Portal
    • Requirement
    • User
    • Device
    • Driving Alert
    • Push Notification
    • Invitations
    • Subscription
    • Trip
    • Location
    • Driving Summary
    • Discount
    • Scoring
    • Vehicle
    • Leaderboard
    • Rewards
    • Submit consent to EULA
    • Legal documents and FAQ
    • Named Driver
    • Wedge
  • Known Issues
    • iOS
    • Android
      • 1.17.0
      • 1.18.0
      • 1.22.0
  • Releases
    • 1.13.0
      • iOS
      • Android
    • 1.14.0
      • Android
    • 1.15.0
      • iOS
      • Android
    • 1.15.1
    • 1.16.0
      • iOS
      • Android
    • 1.17.0
      • iOS
      • Android
    • 1.18
      • iOS
      • Android
    • 1.18.1
    • 1.19.0
      • iOS
      • Android
    • 1.20.0
      • Android
      • iOS
    • 1.21.0
      • Android
      • iOS
    • 1.22.0
      • Android
      • iOS
    • 1.23.0
      • Android
      • iOS
    • 1.24.0
      • Android
      • iOS
    • 1.24.1
      • iOS
  • Migration
    • iOS
      • 1.15.x -> 1.16.0
      • 1.16.0 -> 1.17.0
      • 1.17.0 -> 1.18.0
      • 1.18.0 -> 1.19.0
      • 1.19.0 -> 1.20.0
      • 1.20.0 -> 1.21.0
      • 1.21.0 -> 1.22.0
      • 1.22.0 -> 1.23.0
      • 1.23.0 -> 1.24.0
      • 1.24.0 -> 1.24.1
    • Android
      • 1.15.x -> 1.16
      • 1.16 -> 1.17
      • 1.17 -> 1.18
      • 1.18 -> 1.19
      • 1.19 -> 1.20
      • 1.20 -> 1.21
      • 1.21 -> 1.22
      • 1.22 -> 1.23
      • 1.23 -> 1.24
  • Support
Powered by GitBook
On this page
  • Usage
  • Importing the library
  • Initializing the Misuse Library(iOS)
  • Calling Misuse API

App misuse

Introducing a new service to send information about application usage to our servers.

Usage

Please contact IMS sales to use this feature.

Importing the library

To use app misuse APIs, add the module dependency and initialize by sending login, logout, or userAppLaunch events.

//Add IMSAppMisuse xcFramework to your project 
import IMSAppMisuse
dependencies {
    ...  
    implementation 'com.drivesync.android:imsappmisuse:1.19.0'
    ...
    }

Initializing the Misuse Library(iOS)

Initialize the Misuse API by creating Identity and PermissionManager objects, then pass them to AppMisuseManager.

import IMSAppMisuse
import IMSInterfaces
import IMSPermissions
import IMSBluetooth

let identity = Identity(apiKey: apiKey,externalReferenceID: userId)
let permissionManager = PermissionManager()

permissionManager.addPermissionProvider(CLLocationManager(), isRequired: true)
permissionManager.addPermissionProvider(CMMotionActivityManager(), isRequired: true)
// Add this, if app requires bluetooth permissions for trip detection
permissionManager.addPermissionProvider(BluetoothPermissionProvider(), isRequired: true)

// Servertype can be used based on two environments (.uat or .prod)
let serverType = .uat

let appMisuseService = AppMisuseManager(identity: identity, permissionManageable: permissionManager,serverType: serverType))

Calling Misuse API

There are a number of API's available depending on the service you require; choose and call the appropriate one accordingly. The serverType can be .uat or .prod based on the deployment environment.

Enabling App misuse API

This API enables the Misuse API Service.

iOS SDK scheduler

  • Call the app misuse scheduler to send the event type every hour by calling AppMisuseManager.enableAppMisuse()

    • Ensure to call the mentioned API within application(_:didFinishLaunchingWithOptions:) of app life cycle and register the scheduler key in the info.plist file for registering the scheduler.

Here's an example.

// Enable the scheduler in application(_:didFinishLaunchingWithOptions:)
AppMisuseManager.enableAppMisuse()
AppMisuseManager.enableAppMisuse(context,AppMisuseManager.AppMisuseServerType)

Disabling App misuse API

This API disables the AppMisuse API Service.

Here's an example.

appMisuseService.disableAppMisuse()
AppMisuseManager.disableAppMisuse(context)

Misuse Login API

This API sends AppMisuse information on Login.

Here's an example.

appMisuseService.sendAppMisuseEvent(eventType: .login, serverType: .prod) { result in
    switch result {
    case .success:
        // successful call
    case .failure(let error):
        // failed with \(error)
    }
}
AppMisuseManager.sendLoginEvent(context)

Misuse Logout API

This API sends AppMisuse information on Logout.

Here's an example.

appMisuseService.sendAppMisuseEvent(eventType: .logout, serverType: .prod) { result in
    switch result {
    case .success:
        // successful call
    case .failure(let error):
        // failed with \(error)
    }
}
AppMisuseManager.sendLogoutEvent(context)

Misuse User App Launch API

This API sends AppMisuse information on User Launch.

Here's an example.

appMisuseService.sendAppMisuseEvent(eventType: .userAppLaunch, serverType: .prod) { result in
    switch result {
    case .success:
        // successful call
    case .failure(let error):
        // failed with \(error)
    }
}
AppMisuseManager.sendAppLaunchEvent(context)

PreviousSecurityNextTime Driven Without Phone

Last updated 5 months ago

For more information on setup, check .

here