SDK

Implementation

If you've completed the steps described in the Setup guides, you are now ready to implement our Cordova plugin for iOS in your app. Our plugin supports iOS 9 and up.

To start please make sure you have followed the Getting started with Cordova tutorial. Once you have met all the requirements and you have prepared your machine for Cordova development you can then start implementing our module.

Install the Plugin

Open the terminal under your project root directory and execute the following command:
cordova plugin add cordova-plugin-notificare-push

As soon as the plugin is installed, you can open the project's workspace using the following command:

open platforms/ios/MyApp.xcworkspace

Where MyApp should be the name of your project.

Open the command line under your project root directory and execute the following command:
npm install cordova-plugin-notificare-push ionic-native-notificare-push

If this is the first Ionic Native plugin you've added to your project, you also need to install the Ionic Native core.

npm install @ionic-native/core

As soon as the plugin is installed, you can open the project's workspace using the following command:

open ios/MyApp.xcworkspace

Where MyApp should be the name of your project.

Configure your App

You will need to add some files included in our native library. For that, please download our latest release here. Unzip the downloaded file and open the resulting folder, then drag and drop Notificare.plist into your Xcode project:

drag drop plist

It is recommended that you create at least two different apps in Notificare using separated environments for development and production. For each app you will have a different set of keys, these keys should be copied and pasted in the file shown above. The DEVELOPMENT property should be set to YES or NO according to the environment you are building for. You can find your app keys by expanding your app's Settings menu item and clicking in App Keys as shown below:

menu

Copy both the Application Key and Application Secret:

keys

And paste them accordingly in the Notificare.plist file:

xcode plist app keys

Entitlements

Before you can start implementing our library code, you will need to add all the capabilities to your project. Go to your app's target and click in the tab Capabilities:

xcode capabilities tab v2

If you're going to implement remote notifications, add the Push Notifications capability:

xcode capabilities push v2

If you add the above capability, you also add the Background Modes capability and check the Remote Notifications option:

xcode capabilities bg modes v2

If you are targeting iOS 15 and using our SDK 2.7 and up, time sensitive notifications require a new capability. Add the Time Sensitive Notifications capability:

xcode capabilities time sensitive v2

If you've subscribed to the Loyalty add-on and you will handle digital cards, then you should add the Wallet capability:

xcode capabilities wallet v2

If you've subscribed to the Monetize add-on and you will sell digital products in your app, then you should add the In-App Purchase capability:

xcode capabilities in app purchases v2

If you've subscribed to the Users & Authentication add-on and you will implement OAuth2 features in your app, then you should add the Keychain Sharing capability:

xcode capabilities keychain sharing v2

If you are going to implement the NFC Reader capabilities of our library, you must add the Near Field Communication Tag Reading capability:

xcode capabilities nfc v2

If you are going to use Dynamic Links, you must add the Associated Domains capability and add all the domain prefixes you've created:

xcode capabilities associated domains v2

Implementation

You are now ready to start implementing functionality in javascript.

Open your index.js file and add the following inside the deviceready listener:

document.addEventListener('deviceready', function(){

    Notificare.launch();

    Notificare.on('ready', function(app){

    });

    ... more code

}, false);

Open your App component and launch Notificare. If you're using React, you can use the following snippet.

useEffect(() => {
  Notificare.launch();

  Notificare.on('ready', (data) => {

  });
}, []);

At this point, you have completed the basic setup of our library. Keep reading our implementation guides to dive deeper into each feature available in our SDK.