Required Dependencies and Permissions
  • 09 Feb 2024
  • 2 Minutes to read

    Required Dependencies and Permissions


      Article Summary

      This guide helps you understand the requirements for SDK setup, native steps, required dependencies and permissions.

      Required for Setup

      • An Android device or emulator with minimum APi 19
      • A Google / Firebase Cloud Messaging Server Key and google-services.json imported in your app
      • Android Studio
      your title goes here

      Your project needs to support AndroidX libraries.

      Android Native Steps

      1. Open your project level build.gradle file.
      2. Add google-services inside of your project dependencies.
      3. Add https://mobilesdk.useinsider.com/android inside of repositories for all projects.

      Your title goes here
      If you do not want to target Huawei devices, remove Huawei dependencies.
      buildscript {
          repositories {        
              google()        
              jcenter()        
              maven { url "https://developer.huawei.com/repo/"}    
          }    
          dependencies {
              classpath 'com.android.tools.build:gradle:4.0.0'        
              classpath 'com.google.gms:google-services:4.3.3'        
              classpath 'com.huawei.agconnect:agcp:1.2.1.301'    
          }
      }
      allprojects {
          repositories {        
              google()        
              jcenter()        
              maven {url "https://mobilesdk.useinsider.com/android"}        
              maven {url "https://developer.huawei.com/repo/"}    
          }
      }
      task clean(type: Delete) {
          delete rootProject.buildDir
      }

      4. Open your module level build.gradle file.
      5. Declare manifestPlaceholders inside android > defaultConfig with your Insider partner name.

      android {
      ...
         defaultConfig {
             // DO NOT FORGET to change your_partner_name.
             // Use only lowercase and your_partner_name is provided by Insider.
             manifestPlaceholders = [partner:"your_partner_name"]
      ...
         }
      ...
      }

      6. Add "single task" as launchMode on your main activity in AndroidManifest.xml file.  

      AndroidManifest.xml:

      android:launchMode="singleTask"

      Your title goes here
      <uses-permission android:name="android.permission.WAKE_LOCK"/> is optional.

      Required Only For React Native and Flutter SDKs

      1. Remove android:allowBackup="false" from your AndroidManifest.xml file.  

      2. If you are using proguard, add the following lines to your proguard-rules.pro file.

      -keep class com.useinsider.insider.Insider { *; }
      
      -keep interface com.useinsider.insider.InsiderCallback { *; }
      -keep class com.useinsider.insider.InsiderUser { *; }
      -keep class com.useinsider.insider.InsiderProduct { *; }
      -keep class com.useinsider.insider.InsiderEvent { *; }
      -keep class com.useinsider.insider.InsiderCallbackType { *; }
      -keep class com.useinsider.insider.InsiderGender { *; }
      -keep class com.useinsider.insider.InsiderIdentifiers { *; }
      
      -keep interface com.useinsider.insider.RecommendationEngine$SmartRecommendation { *; }
      -keep interface com.useinsider.insider.MessageCenterData { *; }
      -keep class com.useinsider.insider.Geofence { *; }
      -keep class com.useinsider.insider.ContentOptimizerDataType { *; }
      -keep class org.openudid.** { *; }
      -keep class com.useinsider.insider.OpenUDID_manager { *; }

      Required Dependencies and Permissions

      1. Open your module level build.gradle file.
      2. Set the following required dependencies.

      The examples below show where to implement required dependencies. Please keep in mind that, the versions for Insider SDK is an example in the line below as "com.useinsider:insider:13.0.0".
      This is an older version, please check latest SDKs from our SDK Changelog.

      //14.1.3 and lower versions, Huawei included
      implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
      implementation 'androidx.security:security-crypto:1.0.0'
      
      implementation 'com.google.firebase:firebase-messaging:23.1.1'
      implementation 'com.google.android.gms:play-services-location:21.0.1'
      implementation 'com.google.android.play:core-ktx:1.8.1'
      
      implementation 'com.useinsider:insider:14.1.3'
      
      implementation 'com.huawei.hms:push:6.5.0.300'
      implementation 'com.huawei.hms:ads-identifier:3.4.39.302'
      implementation 'com.huawei.hms:location:6.4.0.300'
      //14.1.3 and lower versions, non-Huawei
      implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
      implementation 'androidx.security:security-crypto:1.0.0'
      
      implementation 'com.google.firebase:firebase-messaging:23.1.1'
      implementation 'com.google.android.gms:play-services-location:21.0.1'
      implementation 'com.google.android.play:core-ktx:1.8.1'
      
      implementation 'com.useinsider:insider:14.1.3-nh'
      //14.2.0 and higher versions, Huawei included
      implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
      implementation 'androidx.security:security-crypto:1.1.0-alpha06'
      
      implementation 'com.google.firebase:firebase-messaging:23.1.1'
      implementation 'com.google.android.gms:play-services-location:21.0.1'
      implementation 'com.google.android.play:review:2.0.1'
      
      implementation 'com.useinsider:insider:14.2.0'
      
      implementation 'com.huawei.hms:push:6.5.0.300'
      implementation 'com.huawei.hms:ads-identifier:3.4.39.302'
      implementation 'com.huawei.hms:location:6.4.0.300'
      //14.2.0 and higher versions, non-Huawei
      implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
      implementation 'androidx.security:security-crypto:1.1.0-alpha06'
      
      implementation 'com.google.firebase:firebase-messaging:23.1.1'
      implementation 'com.google.android.gms:play-services-location:21.0.1'
      implementation 'com.google.android.play:review:2.0.1'
      
      implementation 'com.useinsider:insider:14.2.0-nh'
      apply plugin: 'com.google.gms.google-services'
      apply plugin: 'com.huawei.agconnect'

      Sync

      Add below permissions to your AndroidManifest.xml file.

      <uses-permission android:name="android.permission.INTERNET"/>
      //Optional for Geofence
      <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" />

      Was this article helpful?


      ESC

      Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses