Skip to content

Example application guide 5.x

Alexander Boldyrev edited this page Oct 17, 2024 · 2 revisions

For 6.x version - Example Application Guide

How to run example application

Prepare application configuration in portal

As the first step, you will need to have an Application with Push enabled set up in Infobip Portal for your account. If you already have it, then you can skip this section, otherwise:

  1. Prepare your Cloud Messaging credentials to get Sender ID and Server API Key.

  2. Prepare your Infobip account (https://portal.infobip.com/push/applications) to get your Application Code:

    1. Create new application on Infobip Push portal.
    2. Navigate to your Application where you will get the Application Code.
    3. Mark the "Available on Android" checkbox.
    4. Insert previously obtained FCM Server Key (Server API Key).
    CUP Settings

Run example application in Android Studio

Clone SDK repository and open the project in Android Studio. Go to infobip-mobile-messaging-android-demo module and add Cloud Sender ID and Application Code from previous step to strings.xml:

<resources>
    <string name="google_app_id">YOUR FCM SENDER</string>
    <string name="infobip_application_code">YOUR APPLICATION CODE</string>
    ...
</resources>

infobip-mobile-messaging-android-demo is an example Android application for Mobile SDK and it has multiple product flavours configured for different use-cases.

Product flavour Description
push application with simple layout which receives messages sent from the portal or through API
deeplink application which handles deeplinks in messages as described in: How to use "deeplink" to land user to a particular app page?
web application which receives push messages and opens web view on notification tap as described in: How to open application webView on message tap?
chat application with simple chat view layout where you can send messages and receive messages from API

In order to run one of the flavours, select {flavour}Debug or {flavour}Release configuration for infobip-mobile-messaging-android-demo in Build Variants menu in Android Studio and run it as Android application on any Android device or emulator.

Running chat example

Use chatDebug or chatRelease for debug and release configurations accordingly. Once application starts, there is a button that leads you to the chat activity where you'll be able to send and receive messages.

Clone this wiki locally