Android Native SDK Setup

Steps for setting up your Android app with iZooto's App Notifications.

Follow the steps mentioned below.

Step 1: Prerequisites

  • Your iZooto Account ID. You can find it under Settings in your account.
  • Google/Firebase Server API Key
  • Android Studio
  • An Android 4.3 or newer device or emulator with 'Google Play services' installed.
  • Google-Services.json file should already be added to your project. Learn More.

Step 2: Add iZooto Dependencies

2.1 Open your app/build.gradle (Module: app) file, add/modify the following lines of code inside the Android > defaultConfig section:

android {
 defaultConfig{
    manifestPlaceholders = [
        izooto_app_id : 'YOUR_iZOOTO_ACCOUNT_ID_HERE'
        ]
    }
}

2.2 Add the following lines of code to the dependencies section:

dependencies
{
  implementation 'com.izooto:android-sdk:[1.0.0,2.1.9]'
    implementation platform('com.google.firebase:firebase-bom:26.0.0')
    implementation 'com.google.firebase:firebase-messaging'
}

👍

Sync Gradle

Make sure to press "Sync Now" on the banner that pops up after saving!

Step 3: AndroidManifest.XML Changes

3.1 Open AndroidManifest.xml and add the following lines of code inside the manifest tag:

<uses-permission android:name="android.permission.INTERNET"/>
//REQUIRED FOR INTERNET PERMISSIONS

3.2 Add the following lines of code inside the application tag:

<application
   android:name=".MyApplicationName" > // Change this to your Application Class
</application>

Step 4: Add Required Code

4.1 Add the following to the onCreate method in your Application class.

import com.izooto.iZooto;

public class MyApplicationName extends Application
{
  @Override
    public void onCreate() {
      super.onCreate();
    
      // iZooto Initialization
      iZooto.initialize(this).build();
 }
}
import com.izooto.iZooto

class MyApplication:Application(){
    override fun onCreate() {
     super.onCreate()
          
     // iZooto Initialization
     iZooto.initialize(this).build();    
    }
   }

❗️

FirebaseMessagingService() is already handled in iZooto's SDK. If you have added this as an explicit method, please comment out the code.

Step 5: Run and Test you app

Run your app on a device or the Android emulator to make sure your device is subscribed to notifications and can receive notifications sent from the iZooto dashboard.

❗️

Make sure that you have configured your FCM Server API Key and Sender ID corresponding to your Android Project on iZooto.

Click here for a guide.

Step 6: Customize what your app does when a notification is clicked or received (Optional)

Notification Listeners

onNotificationReceived - This will be called when a notification is received.

onNotificationOpened - This will be called when a notification is tapped on.


Did this page help you?