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:
- Firebase Setup: Setup Firebase and create application in Firebase Console. You can refer to the FCM Documentation for more details.
- Xiaomi Setup: Setup Xiaomi Developer Account and create application in Xiaomi push console. You may refer to the Mi Push Documentation for more details.
- 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.
-
Add mavenCentral() repository to your root build gradle.
// place the below snippet in your project gradle file allprojects { repositories { ... mavenCentral() } }
-
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
- 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:
- Create a temporary User Profile, in case the customer is not signed in, with Push and In-App token details
- 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)
- 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.
-
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.
-
Adding Dependencies: Add following line inside dependencies {...} in app build gradle
dependencies{ ... implementation 'io.fyno.kotlin-sdk:core:0.0.5' }
-
Initialisation: Fyno Core SDK is responsible for initialising the context to save Fyno configurations and user profiling.
- To initialise Fyno SDK you have to call
FynoCore.initialize(this, "WSID", "APIKEY")
- When a user logs in, to create a user profile, call
FynoUser.identify("Distinct_Id")
- To initialise Fyno SDK you have to call
-
-
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.
-
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' }
-
Initialisation: Fyno Push SDK is responsible for handling push rendering and push amplification.
-
To initialise Fyno Push you are required to use
FynoCore
you have to callFynoCore.initilize(this, "WSID", "APIKEY")
-
To initialize push, call
FynoPush.registerPush
method -
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")
-
-
-
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-
callback_url
- Required parameter - You can get thecallback_url
from the notification additional payload if the notification triggered from Fyno. -
status
- Required parameter -status
of the push notification to be notified to Fyno. It is of typeMessageStatus
. The possible message statuses that you can receive are:MessageStatus.RECEIVED
MessageStatus.OPENED
MessageStatus.CLICKED
MessageStatus.DISMISSED
-
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.
Updated 8 months ago