singular_cordova_sdk

Singular Cordova SDK


Keywords
ecosystem:cordova, cordova-ios, cordova-android
License
MIT
Install
npm install singular_cordova_sdk@1.4.0

Documentation

Cordova Singular plugin for Android and iOS.

npm version
License: MIT
Downloads

Table of content

  • iOS Singular SDK v12.4.2
  • Android Singular SDK 12.5.5
$ cordova plugin add singular_cordova_sdk  

NOTE: for Ionic installation see this section

Great installation, usage and setup guides can be viewed here.

Prepare your Singular API Key and Secret Key

Add the following lines to your code to be able to initialize tracking with your own Singular API Key and Secret Key:

document.addEventListener('deviceready', function() {  
  
    var singularConfig = new cordova.plugins.SingularCordovaSdk.SingularConfig("apiKey", "secretKey");
    cordova.plugins.SingularCordovaSdk.init(singularConfig);
}, false);  

A sample app can be found in here

Using the cordova object directly

Install the cordova plugin:

$ ionic cordova plugin add singular_cordova_sdk  

In your main ts file, declare a window variable:

declare var cordova;  

Now you can use the Singular plugin directly from cordova:

import {Component} from '@angular/core';  
import {Platform} from '@ionic/angular';  
  
declare var cordova;  
...  
export class HomePage {  
  constructor(public platform: Platform) {  
  this.platform.ready().then(() => {  
    var singularConfig = new cordova.plugins.SingularCordovaSdk.SingularConfig("apiKey", "secretKey");
    cordova.plugins.SingularCordovaSdk.init(singularConfig);  
 }); }}