iOS Open-Source Telematics App with Firebase© integration

Overview

iOS Open-Source Telematics App with Firebase© integration

Description

This Telematics App is developed by Damoov and is distributed free of charge. This app can be used to create your own telematics app for iOS in few steps.

Ready Features

Telematics:

Basic concepts and credentials

Create an account https://app.damoov.com/user/registration and get InstanceId andInstanceKey auth keys to work with the telematics SDK & APIs. How to obtain InsanceId & InstanceKey => https://docs.telematicssdk.com/docs/datahub#user-group-credentials

Additionally, to authenticate users in your app and store users data, you need to create a firebase account: https://firebase.google.com All user data will be stored in the Firebase© Realtime Database, which will allow you to create an app users database without programming skills.

Here you can find a short video guide, how to add launch iOS Open-Source Telematics App:

Watch the video

Setup Firebase© Project

In the next few simple steps, we'll show you how easy it is to create and configure an app in the Firebase© console.

Step 1: After creating your Firebase© account, open your console: https://console.firebase.google.com

Click "Create a project" button.

Step 2: Enter the name of your future Project. Click "Continue" button.

Step 3: For ease of integration, at the next step, we recommend deactivating the "Enable Google Analytics" checkbox.

Click "Create project".

Step 4: Now you need to create a configuration for your iOS app. Click on the "iOS icon" as it us shown on the picture below:

Step 5: Enter your unique iOS Bundle ID. This identifier must be used in your application in xCode. Enter App Nickname. Click "Register app" next.

Step 6: On this step, download the provided GoogleService-Info.plist file. You need to put it in our Telematics App source code, as it is shown on the picture below:

Step 7: You can skip the "Add Firebase SDK" & "Add initialization code" steps below, because we already did it for you in our Telematics App:) Finish the setup and click on "Continue to console".

Step 8: Important. In order for your users to create accounts to log into your app, you need to go to "Authentication" section on the left side of the menu.

Step 9: In the "Sign-in method" tab, click on the Provider's "Email/Password" on the right "pencil" (Edit configuration hint) as in the picture below. If you need to perform authorization using the "Phone" Provider - select the setting of this item.

In order for phone auth to work in your xCode project, you need to register Firebase URL Schemes in the Info section of your application.

Step 10: Switch to "Enable" and click "Save" button. Now your users can login to the app.

Step 11: We need to activate Firebase© Realtime Database. This will allow you to store the data of all your users in this simple web interface. Go to the Realtime Database section on the left side of the menu and click on the "Create Database" button.

Step 12: Choose any Realtime Database location value.

Step 13: Select "Start a locked mode" and click the "Enable" button.

Step 14: Now you need to change rules for your Realtime Database. You need to go to “Realtime Database” section on the left side of the menu. In the “Rules” tab change read and write fields to ".read": true & ".write": true.

Step 15: Open our TelematicsApp in xCode, make sure to transfer the GoogleService-Info.plist file to your project (See Step 5 above) and Enjoy!

Build & Run!

Setup Telematics App Configuration.plist file

Open our Telematics App source code by tapping TelematicsApp.xcworkspace file.

For your convenience, we have created a standard iOS file with parameters named Configuration.plist, where you can specify the basic settings for your future app. Using this file, you can configure the basic parameters of your application by specifying server addresses, basic settings and links, as well as specifying several images for an individual design. Carefully study the parameters provided below for further work.

Settings Key Value
configName Default Your app configuration name. Not need to change, you can use any of your choice. By default TelematicsApp_Configuration
instanceId Unique ID code for the application to work. Required!
instanceKey Unique KEY code for the application to work. Required!
indicatorsServiceURL Basic https address to work with Indicators APIs. By default, we provide you https-address of our TEST servers for debugging. Before the release your app, you can get the addresses to enter PRODUCTION environment
driveCoinsServiceURL Basic https address to work with DriveCoins API.
leaderboardServiceRootURL Basic https address to work with the user leaderboard and Leaderboard API.
carServiceURL Basic https address to work with CarService API.
claimsServiceURL Basic https address to work with ClaimsService API.
mapsAppIdKey App Id for HEREmaps API
mapsAppCode App Code for HEREmaps API
mapsLicenseKey License key for HEREmaps API
mapsRestApiKey Rest API key for HEREmaps API
enableHF BOOL parameter, that activates High Frequency data in Telematics SDK. By defaults true
linkPrivacyPolicy Link for Privacy Policy
linkTermsOfUse Link for Terms Of Use
linkHowItWorks Link for How It Works
telematicsSettingsOS12 Link for Telematics Settings before iOS13
telematicsSettingsOS13 Link for Telematics Settings for iOS13/iOS14
linkSupportEmail Link for support email address
appStoreAppId Your unique APPID for the AppStore
mainLogoColor App logo in colors style for display in app. Specifies the file name, you need to use.
mainLogoClear App logo is transparent style for display in the app. Specifies the file name, you need to use.
mainBackgroundImg String name of the Asset image used in the Feed or Profile screen
additionalBackgroundImg String name of the Asset image used in the Dashboard screen
mainTabBarNumber TabBar number, which will open first when the application starts. By default 0
dashboardTabBarNumber TabBar number, where Dashboard will open. By default 0
feedTabBarNumber TabBar number, defining what the Feed screen will be in turn in the application. By default 1
profileTabBarNumber TabBar number, defining what the Profile screen will be in turn in the application. By default 2
needDistanceForScoringKm The minimum distance required to display Indicators statistics and user scores. By default 10 km
showTrackSignatureCustomButton BOOL parameter, determines whether the Driver Signature button should be displayed on the Feed screen. By default 1. Cannot be used simultaneously with key showTrackTagCustomButton in 1 value!
showTrackTagCustomButton BOOL parameter, determines whether the Tag Switcher should be displayed on the Feed screen. By default 0. Cannot be used simultaneously with key showTrackSignatureCustomButton in 1 value!
needTripsDeleting BOOL parameter, determining if user can delete their trips
needDistanceInMiles BOOL parameter, determining use the default distance traveled in the entire application in km/miles
needAmPmTime BOOL parameter, determining use AM/PM time format in the entire application
needEventsReviewButton BOOL parameter, allowing to mark events on the map

Telematics SDK Setup

We use CocoaPods dependency libraries. The Telematics SDK is installed by default in the Telematics app using the pod 'RaxelPulse' command in the application Podfile. After the first download of this app, you need to enter the command pod install in the macOS Terminal. This will install the required dependency libraries for the app to work correctly. Run Your new application by opening the TelematicsApp.xcworkspace file in the source code folder after. Below we present the basic methods for AppDelegate that allow you to initialize the Telematics SDK in a few steps.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [RPEntry initializeWithRequestingPermissions:NO];
    [RPEntry instance].lowPowerModeDelegate = self;
    [RPEntry instance].accuracyAuthorizationDelegate = self;
    [RPEntry sdkEnableHF:YES];

    [RPEntry instance].virtualDeviceToken = `VIRTUAL_DEVICE_TOKEN`; // Unique user device token
    if ([RPEntry instance].virtualDeviceToken.length > 0) {
        [RPEntry initializeWithRequestingPermissions:YES];
    }

    [RPEntry application:application didFinishLaunchingWithOptions:launchOptions];
    [RPEntry instance].apiLanguage = RPApiLanguageEnglish;

    if ([ASIdentifierManager sharedManager].isAdvertisingTrackingEnabled) {
        [RPEntry instance].advertisingIdentifier = [ASIdentifierManager sharedManager].advertisingIdentifier;
    };
    return YES;
}

Telematics SDK | Permission Wizard

An important part to record user's trips is to properly request permissions to use the user's Location and Motion & Fitness activity. Telematics SDK includes a specially designed Wizard that helps the user explain why the application needs it and make the right choice. Note: this wizard is fully cutomizable, you can find the documentation here: https://docs.telematicssdk.com/docs/ios-sdk-asset-customisation

Below is an example of initialization with the launch of the step-by-stepWizard

[[RPCSettings returnInstance] setWizardNextButtonBgColor:[UIColor blackColor]];
[[RPCSettings returnInstance] setAppName:@"TelematicsApp"];
        
[[RPCPermissionsWizard returnInstance] launchWithFinish:^(BOOL showWizzard) {
    [RPEntry initializeWithRequestingPermissions:YES];
    [RPEntry instance].disableTracking = NO;
    [RPEntry instance].virtualDeviceToken = `VIRTUAL_DEVICE_TOKEN`; // Unique user device token
}];

[[RPCPermissionsWizard returnInstance] setupHandlersWithUserNotificationResponce:^(BOOL granted, NSError * _Nullable error) {
    NSLog(@"PUSH_NOTIFICATIONS INIT SUCCESS");
} motionManagerResponce:^(BOOL granted, NSError * _Nullable error) {
    NSLog(@"MOTION INIT SUCCESS");
} locationManagerResponce:^(CLAuthorizationStatus status) {
    NSLog(@"LOCATION INIT SUCCESS");
}];

LoginAuthFramework Authentication

We have created a special Framework that allows you to receive deviceToken, jwToken & refreshToken for full integration with our services. These keys are required to make calls to our APIs.

LoginAuth Framework is already integrated into this Telematics App.

You can find complete information about LoginAuth Framework in our repository https://github.com/Mobile-Telematics/LoginAuthFramework-iOS

Screens

Dashboard

Our goal is to provide your users with a user-friendly interface to get the best user experience. To get the first data, user usually needs to drive a short distance. We set this parameter in the configuration file with the needDistanceForScoringKm key.

Until the user overcomes the minimum required distance, he will see a special DemoDashboard, which we created in order to show user the main features of the application at an early stage. After overcoming the required minimum distance, the MainDashboard will be automatically available.

Feed Trips

The Trips screen displays the trips users have made. To get rides, we use the method in the Telematics SDK library methods:

NSUInteger limit = 10;
__weak typeof(self) _weakSelf = self;
[self.dataSource setNextPageBlock:^(NSUInteger offset, PageLoadedBlock pageLoaded) {
    [[RPEntry instance].api getTracksWithOffset:offset limit:limit startDate:nil endDate:nil completion:^(id response, NSError *error) {
    RPFeed* feedScreen = (RPFeed*)response;
    if (feedScreen.tracks.count) {
        pageLoaded(feed.tracks); // Success
    } else {
        pageLoaded(@[]); // No user tracks
    }
    }];
}];

Using the example of the Telematics App, you can see how you can implement a page with trips, as well as use swiping with pagination and alternate loading.

Feed Type of Transport

The Telematics SDK allows users to change their role for any trip. Remember that to display the button for switching Type of Transport, you must set the value showTrackSignatureCustomButton in Configuration file.

[[RPEntry instance].api changeTrackOrigin:'USER_DRIVER_SIGNATURE_ROLE' forTrackToken:'SELECTED_TRACK_TOKEN' completion:^(id response, NSError *error) {
    dispatch_async(dispatch_get_main_queue(), ^{
        // Success
    });
}];

USER_DRIVER_SIGNATURE_ROLE can only take the following string values below!

  • OriginalDriver
  • Passenger
  • Bus
  • Motorcycle
  • Train
  • Taxi
  • Bicycle
  • Other

Feed Tags

Depending on your product use cases, you can also use our Tags feature. You can learn more about it here: https://docs.telematicssdk.com/docs/tags We also offer you a convenient interface for switching certain tags for each trip. If you specify in the configuration file true for showTrackTagCustomButton key, the Feed screen will allow to quickly switch between tags for each trip.

NOTE! Keys showTrackTagCustomButton and showTrackSignatureCustomButton must be used separately!

The Telematics SDK allows users to add specific uniquetags to any ride for ease of use. For example, by adding tag options to any trip, you will be able to mark specific trips for Business/Personal or other options:

RPTag *tag = [[RPTag alloc] init];
tag.tag = @"Business"; // Your custom tag
tag.source = @"TelematicsApp"; // Your AppStore app name

[[RPEntry instance].api addTrackTags:[[NSArray alloc] initWithObjects:tag, nil] to:`SELECTED_TRACK_TOKEN` completion:^(id response, NSArray *error) {
    dispatch_async(dispatch_get_main_queue(), ^{
        // Tag success installed. Reload Feed screen trips now
    });
}];

You can also remove back any tag previously set:

[[RPEntry instance].api removeTrackTags:[[NSArray alloc] initWithObjects:tag, nil] from:
   
     completion:^(id response, NSArray *error) {
    dispatch_async(dispatch_get_main_queue(), ^{
        // Tag deleted. Reload Feed screen trips now
    });
}];

   

NOTE: you can use DEL tag and hide the trips marked by it in the app. These trips will be shown in DataHub on List of Trips page with a special mark that these trips were hidden in the app.

Trip Details

Telematics App for iOS uses HERE Maps to display the user's trips on a map. Before you use this screen for PRODUCTION environment, you need to get access API keys to the HERE Maps to view the details of user trips. In the app we provide you with a key for TEST environment. If you would like to use PRODUCTION environment with your app Bunble Identifier for HEREMaps API, visit https://developer.here.com

Having received a list of the user's trips, you can refer to your array of trips and get even more detailed information, as well as a set of waypoints to be displayed on the HEREmaps API.

[[RPEntry instance].api getTrackWithTrackToken:`SELECTED_TRACK_TOKEN` completion:^(id response, NSError *error) {
    RPTrackProcessed * track = response; // Detailed track information with points
}];

Our Telematics App provides you with its own version of displaying and drawing trips. Study this view's' carefully and figure out what functionality you want to leave in your future application.

Trip Details events

We allow users to see the events that happened to them during the trip. We detect major events:Acceleration,Braking,Speeding,Cornering,PhoneUsage. In the Telematics App, we offer you a clear interface that allows the user to change any event on the map if it's not correct or delete this event. Also this feature allows us to make our AI-models much clever.

Leaderboard

You can learn more about these services by following to our docs: https://docs.telematicssdk.com/docs/leaderboards

All 9 types of Leaderboard are presented in the Telematics App and you can figure out which of these options you actually need.

Note! Only users who have trips during latest 14 days participate in Leaderboard. Use placeholders for new and lost users.

My Rewards

Our telematics app allows you to work with DriveCoins and Streaks for each user:

You can learn more about these services by following to our docs: DriveCoins - https://docs.telematicssdk.com/docs/drivecoins Streaks - https://docs.telematicssdk.com/docs/streaks-1

In detail, you can see the work with methods for rewards in the Telematics App source code in the DriveCoins section.

Settings

Settings screen gives you the opportunity to make specific settings for the entire application, provide links to any guides, as well as addresses of technical support etc.

Use the values in the Configuration.plist file for easy linking for Privacy Policy, Email address or Rate you app links. This will help you easily customize the Settings screen.

User Log Out

In the Telematics App source code, we show you an option to clear user data after logging out. Do not forget - to stop tracking and record user trips, you need to explicitly delete VIRTUAL_DEVICE_TOKEN. This can be done using Telematics SDK method:

[[RPEntry instance] removeVirtualDeviceToken];
[[FIRAuth auth] signOut:nil];

You can also disable SDK with the trips uploading to prevent already recorded and stored on the device trips been not uploaded to Damoov platform. Learn more about available SDK methods here: https://docs.telematicssdk.com/docs/methods-for-ios-app

Connect OBD device

Telematics App provides you with the optional functionality to connect the app with an OBD vehicle adapter using Bluetooth® technology. OBD adapter is a small device that plugs into the CAN-port of your car.

Telematics App created by Damoov, has a full range of functionality that allows you to read almost any information and indicators from your vehicle, and add it to trips recorded by the Telematics App on iOS/Android. Connecting and disconnecting to your iOS device happens automatically. OBD adapter can detect accidents.

Detailed documentation and the basic principles of operation can be found in the development portal https://docs.telematicssdk.com/docs/bluetooth-obd To fully work with this functionality, you need additional equipment, which we can provide upon your request.

Claims

You can create Inspections, report road accidents, any damage to your vehicle, attach photos and fill out all the basic information directly from your mobile device. Machine learning technology from photos taken with a smartphone can determine the degree of damage, the honesty of the client, and rigged accidents. The created Inspection can be considered on your side, which gives you the most modern approach for the insurance business and many other areas of activity.

Measures

In Settings, you can work with units of measurement. By default, there are 2 parameters in the Configuration.plist project file. BOOL needDistanceInMiles: By default "0" - need distance in km's. If you set "1" - need distance in miles in the whole app. BOOL needAmPmTime: By default "0" - need 24-hour time format. If you set "1" - need 12-hour AM/PM format in the whole app.

The user can additionally choose the format of the units of measurement, regardless of your preset values. In the Measures section of the app source-code you will find the parameters for the "Distance", "Date format", "Time format" switches.

Join a Company

If you have a Company invitation code, enter it in the Join a Company section in Settings of our Telematics App. We have made an additional possibility that now your users can join any company upon request, if required.

Other features

We have tried to make for you convenient settings and easy entry for any part of the application. Having studied in more detail, you will see that you can customize any part of the Telematics App or Telematics SDK for your purposes, including fonts, official colors used in the application, and much more.

For example, in the source code folder you can find: Color.m - a file containing all the colors used in Telematics app. Font.m - a file containing all the fonts used in Telematics app. In theUI project folder you can find all sorts of improvements for labels, buttons or other styles used in the Telematics App.

Advanced Settings

To fully understand how the Telematics SDK and all our services work, use our detailed docs and guides https://docs.telematicssdk.com/ to make all the process as easy as possible.

All detailed information on using Firebase© can be found in the documentation https://firebase.google.com/docs/auth/ios/start

Telematics App for iOS works together with HERE maps to display the user's trips on a map. To receive a key for the PRODUCTION environment, you need to create your own account https://developer.here.com

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-2021 DATA MOTION PTE. LTD. All rights reserved.
You might also like...
An open source walk tracking iOS App written in Swift
An open source walk tracking iOS App written in Swift

Swift-Walk-Tracker An open source walk tracking iOS App written in Swift About The walk tracking application was intended to be incredibly simplistic.

A free open source iOS app for events or conferences
A free open source iOS app for events or conferences

EventBlank iOS App I go to a lot of conferences and events and noticed that few of them have a proper iPhone app. And I can understand that - there ar

An open-source iOS app for listening to podcasts.

Ceres An open-source iOS app for listening to podcasts. In order to build this application you need to add a Keys.plist to the folder. Inside you need

Open source, non-custodial Terra Wallet focused on privacy iOS App

iOS Open source non-custodial Terra Wallet. We send your finance from the Earth to the Moon Running the project To run this project update / fetch the

KHabit an open source, pure and minimalistic app which helps you maintain productive habits, and nothing more.

an open source, pure and minimalistic app which helps you maintain productive habits, and nothing more. The app is completely open source, it does not contain in-app or ads, and does not track the user in any way.

an open source, pure and minimalistic app which helps you maintain productive habits, and nothing more.

KHabit an open source, pure and minimalistic app which helps you maintain productive habits, and nothing more. The app is completely open source, it d

iCome Out is an open source project of an unofficial Pornub app for iPhone and iPad
iCome Out is an open source project of an unofficial Pornub app for iPhone and iPad

iCome Out is an open source project of an unofficial Pornub app for iPhone and iPad, written in Swift with some cool features Getting Started Prerequi

OctoPod is a free open source iPhone/iPad app for OctoPrint
OctoPod is a free open source iPhone/iPad app for OctoPrint

OctoPod OctoPod is a free open source iPhone/iPad app for OctoPrint. Build Instructions Download Xcode You will need to install Swift 5.0 and Xcode 11

This app has always been open source! It began with the Big Brain Hackathon and now during Hacktoberfest
This app has always been open source! It began with the Big Brain Hackathon and now during Hacktoberfest

Brain Marks This app has always been open source! It began with the Big Brain Hackathon and now during Hacktoberfest. It is available for free on the

Owner
Damoov
Telematics infrastructure for tracking and safe driving mobile applications.
Damoov
Firebase xcframework integration with SPM

Firebase xcframework integration with SPM A small mirror for https://github.com/firebase/firebase-ios-sdk, to add support for using their binary depen

Ashleigh Kaffenberger 80 Dec 23, 2022
Aplikasi iOS Advanced Level To Do List dengan Firebase Auth, SwiftUI, MVVM Design Pattern, dan Firebase Firestore

Aplikasi Tasker adalah aplikasi iOS To Do List yang dibuat menggunakan Autentikasi Firebase / Firestore dan MVVM Design Pattern.

DK 10 Oct 17, 2022
Firebase Analytics Firebase Notification Alamofire KingFisher Ombdb API

MovieOmdbApp Firebase Analytics Firebase Notification Alamofire KingFisher Ombdb

Kaya 0 Dec 20, 2021
DEVOTE In this SwiftUI tutorial, we will develop a task manager iOS application with Core Data integration.

DEVOTE In this SwiftUI tutorial, we will develop a task manager iOS application with Core Data integration. This is not a project with a boring user interface. This iOS and iPadOS application provides a personal touch and feel.

Noye Samuel 1 Dec 21, 2021
Super basic iOS app to browse open-source-ios-apps

Super basic iOS app to browse open-source-ios-apps

null 76 Nov 28, 2022
Free & Open source To-Do app for iOS

Summary I tried to make a To-Do application for my education graduation project. Table of contents Technologies Features Screenshots Installation For

Enes Nurullah Kendirci 3 Oct 25, 2021
A open source Swift app for iOS 13 that allows you to check your NFC transit card information. Written with SwiftUI.

ABANDONED Metrodroid, which TransitPal was heavily inspired by, now has its own fully functional iOS app! It should be in the App Store "soon". I stro

Robbie Trencheny 132 Jun 30, 2022
Open Source Project of LOST Locations iOS app.

LOST Location Description: LOST Location is a fan made app designed for people visiting Honolulu, Hawaii. This app lists different locations used to s

Adrien Villez 9 Feb 10, 2022
iOS Open Source Application written in Swift. App to manage borrowed books at UFRGS using SABI.

RenovaLivrosUFRGS iOS Open Source Application written in Swift. App to manage borrowed books at UFRGS using SABI. App in portuguese, code and comments

Matheus Cavalca 5 Feb 10, 2022
Giphy is an open source iOS app based on MVVM (Model–view–viewmodel) software architectural pattern.

Giphy(Search and display gifs) - MVVM Description Giphy is an open source iOS app based on MVVM (Model–view–viewmodel) software architectural pattern.

Tirupati Balan 8 Jun 14, 2022