React Native SDK

Comprehensive reference of iZooto's SDK methods for Android.

📘

Just starting with Android?

Check out our React Native SDK Integration guide.

Parameter

Data Type

Description

Initialisation

init

Builder Method

Initialises iZooto to register the device for push notifications. Should be called in the default class in the App.js file.
See React Native SDK Setup for details and code examples.

User Permission

setSubscription

Method

Disables iZooto from sending notifications to the current device.

Notifications Handler

onNotificationReceivedListener

Handler

Called when a notification is received by a device.

onNotificationOpenedListener

Handler

Called when the notification is clicked by the user.

WebView Handler

onWebViewListener

Handler

To open Landing URL inside your app's activity.

Analytics

setFirebaseAnalytics

Method

Send events to Google Analytics to track your campaign performance.

Android Tags

addTag

Method

Use this method to tag a users to a specific value.

removeTag

Method

User this method to remove already tagged users from a value.

Get Tags List
REST: GET API

API

Get a list of all the tags that you have created for you app along with the number of users inside that tag.

Send Campaigns to Tagged Users
REST: POST API

API

Use this to send out notifications to only your tagged users.



Initialization

init

Initialises iZooto to register the device for push notifications. Should be called in the default class in the App.js file.
See React Native SDK Setup for details and code examples.

componentDidMount() {
  iZooto.initialize();
}


User Permission

setSubscription

Method

Can be used to not deliver notifications to a specific device. This method does not officially subscribe or unsubscribe users from the app settings, it unsubscribes them from receiving a push from iZooto.
You can call this method with false to opt-out users from receiving notifications through iZooto. You can pass true later to opt users back into notifications.

The below snippet needs to be added to the App.js file of the code.

componentDidMount() {
  iZooto.setSubscription(false);
}


Notification Handlers

Implement Notification Handlers to send and receive data when a notification is received or clicked,

onNotificationReceivedListener

Handler

Fires when a notification is received. It will be fired when your app is in focus or in the background.

The following snippet goes in the App.js file.

componentDidMount() {
  iZooto.onNotificationReceivedListener(payload => {
    console.log("iZootoExampleReceivedPayload", payload);   // THIS CAN BE CHANGED AS PER REQUIREMENT
  });
}

onNotificationOpenedListener

Handler

Use to process an iZooto notification the user just tapped on.

Add the below code snippet in the App.js file.

componentDidMount() {
  iZooto.onNotificationOpenedListener(data => {
    console.log("iZootoExampleDeeplinkData", data); // THIS CAN BE CHANGED AS PER REQUIREMENT
  });
}

❗️

Please make sure that the application class is defined in your AndroidManifest.XML file.



WebView Handler

onWebViewListener

This method can be used to override iZooto's Landing URL and directly open them inside your app's WebView. No explicit notification handler code is required and you would not have to define additional key: value pairs to do so.
Using this will significantly reduce the campaign creation time.

Add the below code snippet in the App.js file.

componentDidMount() {
  iZooto.onWebViewListener(landingUrl => {
    console.log("iZootoExampleLandingURL", landingUrl); // THIS CAN BE CHANGED AS PER REQUIREMENT
  });
}


Analytics

setFirebaseAnalytics

Method

iZooto will automatically send notification events to your analytics dashboard if Google Analytics for Firebase is correctly implemented.

Events
The iZooto SDK tracks events that pertain to notification open & receive events. The following events are sent:

Event Name

Purpose

push_notification_opened

An iZooto notification was opened

push_notification_received

An iZooto notification was received.

push_notification_influence_open

An application was opened within 2 minutes of an iZooto notification being received.

The iZooto SDK also sends parameters that contain more info about the particular notification the event is attributed to. These can be directly defined when you create a campaign.

Parameter Name

Purpose

source

To attribute this event's source to the iZooto SDK

medium

A formal indication that the medium for the event is a notification.

campaign

By default, it would be your campaign name.

term

Can be used to track keywords

content

Can be used to differentiate between links that point to the same URL.

Follow the Firebase integration documentation and verify that Firebase is correctly functioning inside your application.

Once everything is set up, use the following code snippet in the App.js file to enable passing events to Firebase.

iZooto.setFirebaseAnalytics(true);

👍

You're Done!

Google Analytics for Firebase is now set up to receive iZooto events.


Did this page help you?