Coder Social home page Coder Social logo

telematicsapp-android-dashboard's Introduction

TelematicsApp-Android-Dashboard

Dashboard module of TelematicsApp-Android

Description

This module is created by DATA MOTION PTE. LTD. and allows you to integrate with our UserStatistic API and Dashboard view in a few steps.

Credentials

Before you start using this module, make sure you registered a company account in DataHub. If you are new, please refer to the documentation and register your company account in DataHub. Sing Up

Setup

  1. Download from this repository dashboard_module folder
  2. Move this folder to the project folder next to the app folder
  3. In your settings.gradle (Project settings) add include ':dashboard_module'
  4. Import module:
    dependencies {
        ...
        implementation project(':dashboard_module')
    }

Methods

Initialize

Getting the object and setting the context for the module.

    val dashboardModule = DashboardModule.getInstance()
    dashboardModule.initialize(context)  

Set Here Map Api key

You will need an api key to display a preview of the last trip on the map.

    dashboardModule.setHereMapApiKey(hereApiKey)

Instructions on how to get api key:

Step 1: After creating your HERE account, open your project in https://developer.here.com/projects
In the REST table click "Generate App".

Step 2: Click "Create API key"

Copy API KEY and paste it to setHereMapApiKey method.

Set credentials

    val credentials = Credentials(deviceToken, accessToken)
    dashboardModule.setCredentials(credentials)

deviceToken - is the main individual SDK user identifier. This identifier is used as a key across all our services.

accessToken - or JSON Web Token (JWT) is the main UserService API key, that allows you to get user individual statistics and user scoring by UserStatistics API calls.

Set Dashboard mileage limit

A value that determines when the dashboard will be unlocked to display statistics and scorings.

    dashboardModule.setDashboardMileageLimitKm(10)

Get Dashboard fragment

Getting a fragment to display in your container.

    val fragment = dashboardModule.getDashboardFragment()

Here's an example of using the DashboardModule.

    private fun showDashboard(deviceToken: String, accessToken: String, hereMapKey: String) {
    
        //initialize
        val dashboardModule = DashboardModule.getInstance()
        dashboardModule.initialize(this)
        
        //set here map api key
        dashboardModule.setHereMapApiKey(hereMapKey)
        
        //set credentials
        val credentials = Credentials(deviceToken, accessToken)
        dashboardModule.setCredentials(credentials)
        
        //set distance limit
        dashboardModule.setDashboardMileageLimitKm(10)
        
        //get dashboard fragment
        val dashboardFragment = dashboardModule.getDashboardFragment()
        
        // show fragment
        val container = R.id.container
        val manager: FragmentManager = supportFragmentManager
        val transaction: FragmentTransaction = manager.beginTransaction()
        transaction.replace(container, dashboardFragment)
        transaction.commit()
    }

You can also check full exaple in this repository: DashboardDemoApp

Happy coding!

Links

Official product Web-page

Official API services web-page

Official API references

Official ZenRoad web-page

Official ZenRoad app for iOS

Official ZenRoad app for Android

Official ZenRoad app for Huawei

Copyright © 2020-2022 DATA MOTION PTE. LTD. All rights reserved.

telematicsapp-android-dashboard's People

Contributors

classcorn avatar dmitrynekrasoff avatar redandroidcat avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

atishagrawal

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.