Tutorial: How To Add Release Notes To Your Android App

Adding Release Notes To Your Android App Tutorial

Pro tip: Announcing features and fixes is as important as implementing them.

The best way to supercharge your app releases and drive engagement to new features (or even reactivate existing ones) is to include product updates inside your app. Not only does in-app messaging give you the power to contextualize your product updates, it puts them where they are most useful and thus most likely to result in user action.

Below, check out how easy it is to add in-app release notes using the Appnouncements Android SDK.

1. Create an Appnouncements app

Register for Appnouncements and fill in a few app details. This will let you keep all your app’s release information in one place.

New Android App

2. Integrate the SDK

For the most up-to-date instructions (and to find your API key), check out the SDK integration section of your app in the Appnouncements dashboard.

Android SDK Integration

In your project’s root build.gradle, add jitpack as a repository:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Add the dependency to your project’s build.gradle.

	dependencies {
	  implementation 'com.appnouncements:appnouncements-android:0.1.0'
	}

In your Application Class, initialize Appnouncements with the SDK key that can be found in your dashboard.

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        Appnouncements.initialize(this, "c0748bcd-fc09-4a79-b7cb-5de7caf2e233")
    }
}

In your MainActivity, request the Appnouncements client asynchronously.

class MainActivity : AppCompatActivity(), Client.Listener {
    private var appnouncementsClient: Client? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        Appnouncements.getClientAsync(this)
    }

    override fun onAppnouncementsClientReady(client: Client?) {
        appnouncementsClient = client
    }

    override fun onAppnouncementsClientFailed(error: AppnouncementsException?) {
        Toast.makeText(this, "Failed to get the appnouncements client... See logs.", Toast.LENGTH_LONG).show();
    }
}

3. Integrate Appnouncements with the toolbar

Now we have a client and can integrate Appnouncements in any number of ways:

In this tutorial, we’ll focus on adding it to your Toolbar.

First, we’re going to add Android-ActionItemBadge to your project’s build.gradle so we can get a sweet badge on the icon.

dependencies {
    implementation 'com.mikepenz:actionitembadge:3.3.2@aar'
    implementation 'com.mikepenz:iconics-core:3.0.4@aar'
    implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.4@aar'
}

After that’s done, let’s create a mainmenu.xml file with the notification icon in it.

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/whatsNewToolbarButton"
        android:title="What's new?"
        app:showAsAction="always|always" />
</menu>

And finally, let’s display the icon and badge in your activity by adding the following methods.

    override fun onCreateOptionsMenu(menu: Menu?): Boolean {
        menuInflater.inflate(R.menu.mainmenu, menu)
        whatsNewToolbarButton = menu!!.findItem(R.id.whatsNewToolbarButton)
        setWhatsNewBadge(appnouncementsClient?.unseenReleaseNotesCount ?: 0)
        return true
    }

    override fun onOptionsItemSelected(item: MenuItem?): Boolean {
        if (item?.itemId == R.id.whatsNewToolbarButton) {
            if (appnouncementsClient != null) {
                appnouncementsClient!!.showReleaseNotes(this)
                setWhatsNewBadge(0)
            }
            return true
        }

        return super.onOptionsItemSelected(item)
    }

    override fun onAppnouncementsClientReady(client: Client?) {
        appnouncementsClient = client
        setWhatsNewBadge(client!!.unseenReleaseNotesCount)
    }

    private fun setWhatsNewBadge(count: Int) {
        if (count > 0) {
            ActionItemBadge.update(this, whatsNewToolbarButton, MaterialDesignIconic.Icon.gmi_notifications, ActionItemBadge.BadgeStyles.RED, count)
        } else {
            ActionItemBadge.update(this, whatsNewToolbarButton, MaterialDesignIconic.Icon.gmi_notifications_none, null)
        }
    }

You’ll notice in the sample code that we set the badge icon once when we create the options menu, and again when the Appnouncements client is ready. This ensures that the badge always shows the correct notification count. We also have some code in onOptionsItemSelected that handles showing *new release notes when users click on the icon.

If you launch your app now, you should see an empty notification icon.

First Launch

4. Create your first release

To fix that, let’s create your first release. In the Appnouncements dashboard, click on New Release to get started.

New Release

The most important field is the version: We use this to choose the proper release notes to display to each of your users. Put in your app’s current versionCode found in your build.gradle, then add anything you’d like for your release notes. Feel free to get creative – embedded videos, email links, emojis, and more are all up for grabs. When you’re ready, go ahead and save – and don’t worry if something’s not perfect, because unlike the Play Store, you can always update your Appnouncements release notes later.

Relaunch your app to see the final result…

The Final Product

5. Voilà!

With Appnouncements, adding beautiful release notes is suddenly effortless. And for your next release, you can skip all the implementation steps above, create a new set of notes in a matter of minutes, and move on with your life.