Methods for iOS app
SDK Initialization
First, initialize a new RPEntry class instance with a specified device ID. This method must be the first method calling from RaxelPulse SDK in the applicationdidFinishLaunchingWithOptions
method.
RPEntry.initialize(withRequestingPermissions: false)
[RPEntry initializeWithRequestingPermissions:NO]
Log in/Log out
If the user logs out from the host app, you have to log out SDK as well
Log In/ Log out
if ([self userIsAuthenticated]) {
[RPEntry instance].virtualDeviceToken = [self getDeviceToken];
} else {
/// empty or nil DeviceToken is not allowed
/// Use removeVirtualDeviceToken method for log out from the host app.
[[RPEntry instance] removeVirtualDeviceToken];
}
if (userIsAuthenticated) {
let token = NSString(string: "VIRTUAL_DEVICE_TOKEN") //REQUIRED!
RPEntry.instance().virtualDeviceToken = token
} else {
/// empty device token is not allowed
/// Use removeVirtualDeviceToken method for log out from the host app.
RPEntry.instance().removeVirtualDeviceToken()
}
Enable/ Disable SDK
Empty or nil token is not allowed
-(void)setEnableSdk:(BOOL)value;
-(void)setDisableWithUpload;
+(BOOL)isSDKEnabled;
Enable SDK
[[RPEntry instance] setEnableSdk:true];
RPEntry.instance().setEnableSdk(true)
Disable SDK
[RPEntry instance].disableTracking = YES; //disable tracking
[[RPEntry instance] removeVirtualDeviceToken]; //remove token
RPEntry.instance().disableTracking = true
RPEntry.instance().removeVirtualDeviceToken()
Disable SDK with enforced trip uploading
using this method, SDK will enforce trip uploading and then will be disabled.
[[RPEntry instance] setDisableWithUpload];
RPEntry.instance().setDisableWithUpload()
Check SDK status
BOOL isSDKEnabled = [RPEntry isSDKEnabled];
BOOL isSDKEnabled = RPEntry.isSDKEnabled()
Enable/ Disable Tracking
Disable tracking doesn't disable SDK and it will continue to send Heartbeats. If you want the SDK to stop sending any data, you have to use Disable SDK method
Enable tracking
[RPEntry instance].disableTracking = NO; //enable tracking
RPEntry.instance().disableTracking = false
Disable tracking
[RPEntry instance].disableTracking = YES; //disable tracking
RPEntry.instance().disableTracking = true //disable tracking
Manual start/ stop tracking
Manual start tracking
Manual start tracking doesn't disable automatic stop tracking.
[[RPTracker instance] startTracking];
RPTracker.instance().startTracking()
Manual stop tracking
[[RPTracker instance] stopTracking];
RPTracker.instance().stopTracking()
Persistent Tracking
Persistent tracking ignores all stop tracking reasons and continues before 'stopTracking' method will be called. Max persistent tracking duration is 10 hours. then, it will be automatically terminated.
[[RPTracker instance] startPersistentTracking];
RPTracker.instance().startPersistentTracking()
Enable Aggressive Heartbeats
The telematics SDK supports two operational modes for heartbeats;
Aggressive heartbeats- heartbeats are sent every 20 minutes. SDK is always active.
Normal Heartbeats - heartbeats are sent every 20 minutes but when SDK turns into Standby mode, it will be activated only by a new trip, and heartbeat will be sent respectively.
Mode switcher
- (void)setAggressiveHeartbeats:(BOOL)value;
Example:
[[RPEntry instance] setAggressiveHeartbeats: false];
RPEntry.instance().setAggressiveHeartbeats(false)
Check state
- (BOOL)aggressiveHeartbeat;
Example:
[[RPEntry instance] aggressiveHeartbeat];
RPEntry.instance().aggressiveHeartbeat()
Enable Ads ID
To enable Ads ID, you have to provide an Advertisement identifier to SDK. Please add these lines near the code from the previous section. Make sure, you added import
section
#import <AdSupport/AdSupport.h>
Enable high-frequency data collection (HF)
We strongly recommend keeping it enabled by default
[RPEntry enableHF:true];
RPEntry.enableHF(true)
Enable Accidents detection.
Accidents detection is disabled by default. You can enable detection.
In order for accidents detection to work, you need to enable high-frequency data collection
[RPEntry enableAccidents:true];
RPEntry.enableAccidents(true)
Enable Bluetooth OBD
Bluetooth OBD/ELM functionality enables the host app to work with Bluetooth OBD devices to get in-vehicle data 👉 Dataset . To enable this, please use the method below:
[RPEntry enableELM:true];
RPEntry.enableELM(true)
Connect Bluetooth OBD
Please refer to a special page that we created for the Bluetooth OBD integration
Setting up for iOS app
Setting up for Android app
Create new tag
The detailed information about using Tags is available here
-(void)addFutureTrackTag:(RPTag *)tag completion:(RPAPIITagCallback)callback;
Get tags
-(void)getFutureTrackTag:(NSInteger)timestamp completion:(RPAPIITagGCallback)callback;
Remove a tag
-(void)removeFutureTrackTag:(RPTag *)tag completion:(RPAPIITagCallback)callback;
Remove all tags
-(void)removeAllFutureTrackTagsWithСompletion:(RPAPIITagWCallback)callback;
Get a list of trips
- (void)loadTracks {
[[RPEntry instance].api getTracksWithOffset:0 limit:10 completion:^(id response, NSError *error) {
if (error != nil) {
return;
}
if (![response isKindOfClass:[RPFeed class]]) {
return;
}
RPFeed *feed = response;
NSArray <RPTrackProcessed *> *tracks = feed.tracks;
dispatch_async(dispatch_get_main_queue(), ^{
// Implement updating your ViewController with new data
});
}];
}
func loadTracks() {
RPEntry.instance().api.getTracks(0, limit: 100) { (response, error) in
if let feed = response as? RPFeed {
let tracks = feed.tracks;
DispatchQueue.main.async {
/// Implement updating your ViewController with new data
}
}
if (error != nil) {
DispatchQueue.main.async {
/// Implement alert or logging
}
}
}
}
Get trip details
[[RPEntry instance].api getTrackWithTrackToken:`SELECTED_TRACK_TOKEN` completion:^(id response, NSError *error) {
RPTrackProcessed * track = response; // Detailed track information with points
}];
RPEntry.instance().api.getTrackWithTrackToken("SELECTED_TRACK_TOKEN") { response, error in
//
}
Change a Transportation type
[[RPEntry instance].api changeTrackOrigin:'USER_DRIVER_SIGNATURE_ROLE' forTrackToken:'SELECTED_TRACK_TOKEN' completion:^(id response, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
// Success
});
}];
RPEntry.instance().api.changeTrackOrigin("USER_DRIVER_SIGNATURE_ROLE", forTrackToken: "SELECTED_TRACK_TOKEN") { response, error in
// Success
}
Dictionary
USER_DRIVER_SIGNATURE_ROLE
can only take the following string values below! By default, each trip has the very first role -OriginalDriver
- OriginalDriver
- Passenger
- Bus
- Motorcycle
- Train
- Taxi
- Bicycle
- Other
Upload unsent trips
[[RPEntry instance] uploadUnsentTrips];
RPEntry.instance().uploadUnsentTrips()
Get unsent trips
[[RPEntry instance] getUnsentTripCount:^(NSInteger count) {
NSLog(@"unsent trips count - %ld", (long)count);
}];
RPEntry.instance().getUnsentTripCount { count in
print("unsent trips count - \(count)")
}
Send a custom heartbeat
[[RPEntry instance] sendCustomHeartbeat:@"CustomHeartbeat" completion:^(Boolean success, NSError * _Nullable error) {
if (error) {
NSLog(@"error - %@", error.localizedDescription);
}
}];
RPEntry.instance().sendCustomHeartbeat("CustomHeartbeat") { success, error in
if let error {
print("error - \(error.localizedDescription)")
}
}
Updated about 2 months ago