Fyno Android Push Notification SDK

Fyno's Android Push Notification SDK comes with the ability to provide its users with a multitude of notification features, all bundled into one, allowing it to smartly provide the best and optimised message delivery service from within your application itself.

Prerequisites

In order to get started, there are a few prerequisites that needs to be in place:

  1. Firebase Setup: Setup Firebase and create application in Firebase Console. You can refer to the FCM Documentation for more details.
  2. Xiaomi Setup: Setup Xiaomi Developer Account and create application in Xiaomi push console. You may refer to the Mi Push Documentation for more details.
  3. Configuration: Configure your Fyno Push provider in Fyno App

Installation

This step essentially explains how and where to place the Fyno SDK in your repository in order to have the SDK correctly initialised.

  1. Add mavenCentral() repository to your root build gradle.

    // place the below snippet in your project gradle file
    allprojects {
        repositories {
            ...
            mavenCentral()
        }
    }
    
    
  2. Add Android dependencies inside the app build gradle by adding the below line inside dependencies {}

    implementation 'io.fyno.kotlin-sdk:kotlin-sdk:0.0.4'
    
    

Initialisation

  1. To integrate Fyno Android SDK, initialise Fyno SDK in MainActivity/MainApplication inside onCreate method.
class MyApplication : Application() {

    override fun onCreate() {
        ...
        FynoSdk.initialize(context, workspace_id, api_key)
        super.onCreate()
    }
}
//Initilize
FynoSdk.initialize(context, Workspace_Id, Api_Key)

//Register for push
FynoSdk.registerPush("Xiaomi_App_Id", "Xiaomi_App_Key", "Xiaomi_Push_Region", "Fyno_Integration_Id")

//Identify user on login
FynoSdk.identify("Distinct_Id")

🤓

onCreate Magic!

onCreate allows the SDK to collect the device details and user profile details and transmits this information to your Fyno account to:

  1. Create a temporary User Profile, in case the customer is not signed in, with Push and In-App token details
  2. Create a User Profile with Push and In-App token details, along with other details captured (Including email or mobile number details depending on the inputs received during signing into your application)
  3. Appends details to a User Profile with the matching Distinct_ID for the newly created Push Tokens.

📘

NOTE:

You can also use individual SDK's for communication via Fyno. Read on to understand more about each component.

  1. Fyno Core: Fyno Core initialises the context between your android application and Fyno, which has all the required configurations needed for FynoSDK, FynoPush and FynoCallback to work and helps with profiling the users as well.

    1. Adding Dependencies: Add following line inside dependencies {...} in app build gradle

      dependencies{
          ...
          implementation 'io.fyno.kotlin-sdk:core:0.0.5'
      }
      
      
    2. Initialisation: Fyno Core SDK is responsible for initialising the context to save Fyno configurations and user profiling.

      1. To initialise Fyno SDK you have to call FynoCore.initialize(this, "WSID", "APIKEY")
      2. When a user logs in, to create a user profile, call FynoUser.identify("Distinct_Id")
  2. Fyno Push: Fyno Push handles incoming push notification requests from Fyno and renders the customised push message with different templates as configured in Fyno platform. This library takes care of Push Amplification, if enabled.

    1. Adding Dependencies: Add following line inside dependencies {...} in app build gradle. Also, download the google-services.json from Firebase console and place it in the root folder as per FCM Documentations

      dependencies{
          ...
          implementation 'io.fyno.kotlin-sdkk:pushlibrary:0.0.4'
      }
      
      
    2. Initialisation: Fyno Push SDK is responsible for handling push rendering and push amplification.

      1. To initialise Fyno Push you are required to use FynoCore you have to call FynoCore.initilize(this, "WSID", "APIKEY")

      2. To initialize push, call FynoPush.registerPush method

      3. Push Amplification: To make use of push amplification Follow Mi Push Documentation to implement Xiaomi push

        //register push
        FynoPush.registerPush("Xiaomi_App_Id", "Xiaomi_App_Key", "Xiaomi_Push_Region", "Fyno_Integration_Id")
        //register push without amplification
        FynoPush.registerFcm("Fyno_Integration_id")
        
        
  3. Fyno Callback: Fyno Push SDK is responsible for sending push callbacks to Fyno by calling FynoCallback.updateStatus method. The above method required 2 required parameters and 1 optional parameter

    1. callback_url - Required parameter - You can get the callback_urlfrom the notification additional payload if the notification triggered from Fyno.

    2. status - Required parameter - status of the push notification to be notified to Fyno. It is of type MessageStatus. The possible message statuses that you can receive are:

      1. MessageStatus.RECEIVED
      2. MessageStatus.OPENED
      3. MessageStatus.CLICKED
      4. MessageStatus.DISMISSED
    3. Additional parameters - optional parameters, like device details can be captured here.

      //Updating notification status to Fyno
      FynoCallback.updateStatus("Callback_URL", "Message_Status","Additional_Data")
      
      

💥

Fyno Callback stand-alone

We all love features that can be mixed and matched! Fyno is a firm believer of this and has made our Callback feature with this in mind.

While the callback_url feature works effortlessly through the Fyno Android Push Notification SDK without any additional setup needed, when used independently, you can also use only this piece to get your notification status, which can be found in the data payload of your notification.