Android SDK

Bird Android SDK is a single integration point to bring the power of BirdCRM in building connected user experience to your application.

Using Bird Android SDK, you get access to:

  • Collect contacts

  • Send push notifications

Integrating Bird Android SDK into your application consists of the following steps:

  • Step 1: Add Bird Android SDK dependency

  • Step 2: Set Application Key

  • Step 3: Add permissions

  • Step 4: Push Notifications

    • Add Firebase credentials file

    • Add BirdFirebaseMessagingService

Step 1: Add Bird Android SDK dependency

Add the com.bird:android-sdk dependency to your app’s build.gradle.

dependencies {
  implementation("com.bird:android-sdk:+")
}

Make sure to run Gradle Sync to build your project using the newly added dependency.

Step 2: Set Application Key

Add a new string to your app's strings.xml with the name com_bird_application_key. You can get the value of this application key from "Bird Dashboard / Preferences / Applications".

<resources>
    <string translatable="false"  name="com_bird_application_key">YOUR_APPLICATION_KEY</string>
</resources>

Step 3: Add permissions

No additional permissions need to be set in AndroindManifest.xml. The user will be asked to give Push Notification permissions in runtime.

Step 4: Push Notifications

Firebase

Add Firebase credentials file

Get google-service.json file from your Firebase project and add it to your android application. See more information here

And add the com.google.gms.google-services plugin to both your top-level build.gradle and your app’s build.gradle.

// Inside the top-level build.gradle
plugins {
    id("com.google.gms.google-services") version "4.4.0" apply false
}
// Inside app's build.gradle
plugins {
    id("com.google.gms.google-services")
}

Make sure to run Gradle Sync to build your project using the newly added plugin.

Add BirdFirebaseMessagingService

Add the following com.bird.BirdFirebaseMessagingService as a service inside AndroindManifest.xml.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <application>

        <!-- START: Add This Part -->
        <service 
            android:name="com.bird.BirdFirebaseMessagingService"
            android:exported="false"
            tools:ignore="Instantiatable">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
        </service>
        <!-- END -->

    </application>

</manifest>
Advanced

In case you need to use your own FirebaseMessagingService, you can inherit BirdFirebaseMessagingService, calling the super methods and customizing the rest as you need.

class MyFirebaseMessagingService : BirdFirebaseMessagingService() {
  override fun onMessageReceived(remoteMessage: RemoteMessage?) {
    super.onMessageReceived(remoteMessage)
    
    // Do anything else you need.
  }
}

Then add your class MyFirebaseMessagingService as a service inside AndroindManifest.xml.

<application>

    <!-- START: Add This Part -->
    <service 
        android:name="MyFirebaseMessagingService"
        android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
    </service>
    <!-- END -->

</application>

Examples

You can find examples and report issue on the public repository messagebird/android-sdk.

Last updated