Android

Adding the SDK dependencies

If you are with a version of Kotlin less than 1.5.21, you will have to add the following implementation of coroutines in the gradle dependencies:

🚧

If you don't have a build gradle file, you have to created into platform/android folder

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1'
  • SDK compatibility with Android is as of Android 5.0

Adding Firebase Services

  1. To start you need a file called google-services.json. This file can be exported from the Firebase console.

  2. Move it to the platform/android folder.

  3. Add the following lines:
    -Huawei libraries only need to be added if HMS services are implemented

buildscript {
    repositories {
        ...
        maven {url 'https://developer.huawei.com/repo/'} 
    }
    dependencies {
        ...
        classpath 'com.google.gms:google-services:4.0.+'
    }
}

allprojects {
    repositories {
        ...
        maven {url 'https://developer.huawei.com/repo/'} 
    }
}

apply plugin: 'com.google.gms.google-services'

dependencies {
    implementation "com.google.firebase:firebase-messaging:22.0.0"

    implementation "com.huawei.hms:location:6.0.0.302" // GET LOCATION
}
  1. And add the following lines into tiapp.xml to load into the app manifest
<service android:name="com.indigitall.android.services.StatisticService" />

  <service android:name="com.indigitall.android.services.FirebaseMessagingService" android:exported="false">
  	<intent-filter>
    	<action android:name="com.google.firebase.MESSAGING_EVENT" />
  	</intent-filter>
	</service>

	<receiver android:name="com.indigitall.android.receivers.BootReceiver"
		android:exported="false">
  	<intent-filter>
  		<action android:name="android.intent.action.BOOT_COMPLETED" />
  	</intent-filter>
	</receiver>

Push permission after Android 13 (Api level 33 - Tiramisu)

Android 13 requires you to add the android.permission.POST_NOTIFICATIONS flag to the manifest:

<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

Adding HMS Services

  1. To start you need a file called agconnect-services.json. This file can be exported from the Huawei developer console.

  2. Move it to the platform/android folder.

  3. Add the following code in the manifest of your app.

  4. Add the following lines:

apply plugin: 'com.huawei.agconnect' 

buildscript {
    repositories {
        ...
        maven {url 'https://developer.huawei.com/repo/'} 
    }
    dependencies {
        ...
        classpath 'com.huawei.agconnect:agcp:1.2.1.301' 
    }
}

allprojects {
    repositories {
        ...
        maven {url 'https://developer.huawei.com/repo/'} 
    }
}
...
dependencies {
   implementation "com.huawei.hms:push:6.1.0.300"   
}

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:

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

<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"/>

For further clarification on creating icons, we leave you this link to the Android documentation that may help you: [Product icons](https://material.io/design/iconography/product-icons.html#design-principle