Android

Adding the SDK dependencies

Config the build.gradle of your project as the following example:

buildscript {
    ...
    repositories {
        ...
        maven { url "https://developer.huawei.com/repo/" }
    }
    dependencies {
        ...
        classpath("com.google.gms:google-services:4.3.+")
        classpath("com.huawei.agconnect:agcp:1.4.1.300")
    }
}

allprojects {
    repositories {
        ...
        mavenCentral()
        maven { url "https://developer.huawei.com/repo/" }

    }
}
  • SDK compatibility with Android is as of Android 5.0

Adding the indigitall services

These services are necessary so that our SDK can synchronize device data with indigitall's servers.

<manifest ...>
    <!-- ... -->

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <!-- To obtain the location of the device -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
    <application ...>
        <!-- ... -->

        <!-- MANDATORY -->

        <!-- So that when the user presses a push, the metric is saved -->
        <service android:name="com.indigitall.android.services.StatisticService"/>

        <!-- Daily sync of device data -->
        <service android:name="com.indigitall.android.services.NightService"/>

        <!-- To start services when you restart the device -->
        <receiver android:name="com.indigitall.android.receivers.BootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <!-- OPTIONAL -->

        <!-- So that when the user clicks an InApp message, the metric is saved.
        It is only necessary if you use the InApp message functionality -->
        <service android:name="com.indigitall.android.inapp.services.StatisticInAppService" />

        <!-- To obtain the location of the device.
        It is only necessary if you are going to ask for location permission
        to segment pushes by device location -->
        <receiver android:name="com.indigitall.android.receivers.LocationReceiver">
            <intent-filter>
                <action android:name="LocationReceiver.Action.LOCATION_UPDATE" />
            </intent-filter>
        </receiver>

    </application>
</manifest>

Adding the indigitall services

To activate Firebase notifications you must add your google-services.json file in your android project inside your app folder and modify your build.gradle file as follows:

...
apply from: "../../node_modules/..."
apply plugin: 'com.google.gms.google-services'

Adding HMS Services

To activate HMS notifications you must add your agconnect-services.json file in your android project inside your app folder and modify your build.gradle file as follows:

apply from: "../../node_modules/..."
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.huawei.agconnect'

Setting the notifications icon

This icon will be displayed in the top bar of the Android system and in the header of the pushes sent through your app.
It must be a monochrome icon, that is, the image must contain only one color and alpha.
We give you an example with our logo in monochrome:

48

Here we show you how your code should be in the AndroidManifest.xml (The icon has to be a png)

<manifest ...>
    <!-- ... -->
    <application ...>
        <!-- ... -->

        <!-- Resource for monochrome icon -->
        <meta-data android:name="indigitall.icon" android:resource="@drawable/YOUR_MONOCHROME_ICON"/>

        <!-- Resource for icon color -->
        <meta-data android:name="indigitall.color" android:resource="@color/colorPrimary"/>
    </application>
</manifest>
  • For further clarification on creating icons, we leave you this link to the Android documentation that may help you: Product Icons