Quickstart KMP (Android)
Team
SDK Team
Last Updated
May 29, 2026
Step 1 - Adding permissions to the Manifest
Add the following permissions in AndroidManifest.xml.
1<?xml version="1.0" encoding="utf-8"?>2<manifest xmlns:android="http://schemas.android.com/apk/res/android">34 <uses-permission android:name="android.permission.INTERNET" />5 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />6 <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />7 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />8 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />9 <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />10 <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />11 <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />12 <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />13 <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />1415 ...1617</manifest>
Step 2 - Installing the Group Link library
- In the
settings.gradle.ktsfile, add theJitpackURL inside therepositoriessection:
1...23dependencyResolutionManagement {4 repositories {5 google {6 ...7 }8 mavenCentral()9 maven { url = uri("https://jitpack.io") } // Package repository for Android libraries.10 }11}1213...
- In your project's
build.gradle(androidApp), add the Group Link library by adding the following implementation:
1...23dependencies {4 ...5 implementation("com.grouplinknetwork:lib-grouplinknetwork:4+") // Implementation of the Android library from the Group Link SDK6}78...
Step 3 - Creating the JSON file with your Group Link Token
- Create a file named
grouplink-services.jsoninside the directory.../androidApp/src/main/assets/.
Note: Create the directory .../androidApp/src/main/assets/ if it doesn't already exist in your project.
- Insert the following content below into the JSON
Note: Replace the YOUR_GROUP_LINK_TOKEN with your authentication token (provided by Group Link).1{2 "token": "YOUR_GROUP_LINK_TOKEN"3}
Step 4 - Requesting permissions at runtime
In your project, search for your MainActivity and add the permissions following the model below.
- Import the Group Link library.
- Request permissions at runtime.
1// Example of permission request for Android23package com.grouplink.kmp.test.androidApp45import android.Manifest6import android.app.Activity7...8import com.grouplinknetwork.GroupLink // <---- Importing the Group Link library91011class MainActivity : ComponentActivity() {12 private val REQUEST_PERMISSION_CODE = 420 // Request code for necessary permissions13 private val ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE = 0 // Request code for necessary permissions (Android 6)14 private var count = 0 // Counter to prevent repeated permission requests15 private var countAutoStart = 0 // Counter to prevent repeated auto-start permission requests1617 // Counter to prevent repeated auto-start permission requests18 private val REQUIRED_PERMISSIONS = arrayOf(19 Manifest.permission.BLUETOOTH,20 Manifest.permission.BLUETOOTH_ADMIN,21 Manifest.permission.ACCESS_FINE_LOCATION,22 Manifest.permission.ACCESS_COARSE_LOCATION23 )2425 // Permissions required for operation on Android 10 (Q)26 private val REQUIRED_PERMISSIONS_Q = arrayOf(27 Manifest.permission.BLUETOOTH,28 Manifest.permission.BLUETOOTH_ADMIN,29 Manifest.permission.ACCESS_FINE_LOCATION,30 Manifest.permission.ACCESS_COARSE_LOCATION31 )3233 // Logic for operation on Android 12 (S) and 13 (Tiramisu)34 private fun getRequiredPermissionsS(): Array<String> {35 return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {36 arrayOf(37 Manifest.permission.BLUETOOTH,38 Manifest.permission.BLUETOOTH_ADMIN,39 Manifest.permission.ACCESS_FINE_LOCATION,40 Manifest.permission.ACCESS_COARSE_LOCATION,41 Manifest.permission.BLUETOOTH_SCAN,42 Manifest.permission.BLUETOOTH_ADVERTISE,43 Manifest.permission.BLUETOOTH_CONNECT,44 Manifest.permission.POST_NOTIFICATIONS45 )46 } else {47 arrayOf(48 Manifest.permission.BLUETOOTH,49 Manifest.permission.BLUETOOTH_ADMIN,50 Manifest.permission.ACCESS_FINE_LOCATION,51 Manifest.permission.ACCESS_COARSE_LOCATION,52 Manifest.permission.BLUETOOTH_SCAN,53 Manifest.permission.BLUETOOTH_ADVERTISE,54 Manifest.permission.BLUETOOTH_CONNECT55 )56 }57 }5859 // The onCreate method is where the Group Link SDK is registered and permissions are requested60 override fun onCreate(savedInstanceState: Bundle?) {61 super.onCreate(savedInstanceState)62 enableEdgeToEdge()6364 // Starting the Group Link SDK65 GroupLink.register(66 this, // Application context67 false // Parameter to enable or disable debug mode68 )6970 requestGlPermissions() // Requesting the necessary permissions for the Group Link SDK to function.7172 ...73 }7475 // Method for requesting the necessary permissions76 private fun requestGlPermissions() {77 // Requesting permissions for Android 12 (S)78 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {79 if (!hasNeededPermissionsS()) {80 requestPermissionsS()81 return82 }83 }8485 // Requesting permissions for Android 10 (Q)86 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {87 if (!hasNeededPermissionsQ()) {88 requestPermissionsQ()89 return90 }91 }9293 // Requesting permissions up to Android 9 (Pie)94 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {95 if (!hasNeededPermissions()) {96 requestPermissions()97 return98 }99 }100101 // Checking if all permissions have already been granted102 if (countAutoStart < 1) {103 countAutoStart++104 }105 }106107 // Method to verify if the necessary permissions have been granted108 private fun hasNeededPermissions(): Boolean {109 return REQUIRED_PERMISSIONS.all {110 ActivityCompat.checkSelfPermission(this, it) == PackageManager.PERMISSION_GRANTED111 }112 }113114 // Method to check if the necessary permissions have been granted for Android 10 (Q)115 private fun hasNeededPermissionsQ(): Boolean {116 return REQUIRED_PERMISSIONS_Q.all {117 ActivityCompat.checkSelfPermission(this, it) == PackageManager.PERMISSION_GRANTED118 }119 }120121 // Method to check if the necessary permissions have been granted for Android 12 (S)122 private fun hasNeededPermissionsS(): Boolean {123 return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {124 getRequiredPermissionsS().all {125 ActivityCompat.checkSelfPermission(this, it) == PackageManager.PERMISSION_GRANTED126 }127 } else true128 }129130 // Methods for requesting the necessary permissions for the Group Link SDK to function.131 private fun requestPermissions() {132 ActivityCompat.requestPermissions(this, REQUIRED_PERMISSIONS, REQUEST_PERMISSION_CODE)133 }134135 // Method to request the necessary permissions for Android 10 (Q)136 private fun requestPermissionsQ() {137 ActivityCompat.requestPermissions(this, REQUIRED_PERMISSIONS_Q, REQUEST_PERMISSION_CODE)138 }139140 // Method for requesting the necessary permissions for Android 12 (S)141 private fun requestPermissionsS() {142 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {143 ActivityCompat.requestPermissions(this, getRequiredPermissionsS(), REQUEST_PERMISSION_CODE)144 }145 }146147 // Method for handling the results of permission requests.148 override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {149 if (requestCode == REQUEST_PERMISSION_CODE) {150 if (count < REQUIRED_PERMISSIONS_Q.size) {151 count++152 requestGlPermissions()153 return154 }155156 if (countAutoStart < 1) {157 countAutoStart++158 }159 }160161 super.onRequestPermissionsResult(requestCode, permissions, grantResults)162 }163}164165...166
Now that the Group Link SDK for Android is implemented and the native features are configured, your KMP application is ready to interact with our ecosystem!