Radar Ionic Plugin
Radar is a location platform for mobile apps. This Ionic plugin let's you use Radar features in your Ionic application.
Available Radar Functions
Installation
ionic cordova plugin add ionic-radar
Usage
Setting up Radar Keys
For Android, under src -> android -> com -> Radar
in Radar.java
, add your Radar Key in the initialize method
public void { super.; Context context = this.cordova..; Radar.; Log.; }
For iOS, under ios
in RadarWrapper.swift
, add your Radar Key in the pluginInitialize function
override func pluginInitialize() { Radar.initialize(publishableKey: "your_radar_key");}
Declaring Cordova
On whichever page you want to use the Radar plugin, you can declare cordova
just below your exports, as follows:
declare ;
Start Tracking
When you want to begin tracking the user's location in the background, simply call the start tracking method:
cordova.plugins.RadarPlugin.startTracking;
Stop Tracking
To stop background location tracking, run:
cordova.plugins.RadarPlugin.stopTracking;
Set User ID
If you want to give users a customized user ID rather than the one generated by Radar, you can do it by running the following:
cordova.plugins.RadarPlugin.stopTrackinguserID, ;
Check Permission
Check if the app has location permission:
cordova.plugins.RadarPlugin.checkPermissions;
Get Permission
Ask the user for location permission:
cordova.plugins.RadarPlugin.checkPermissions;