Skip to content

singular-labs/Singular-Cordova-Kids-SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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_kids_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_kids_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);  
 }); }}