Introduction

This Tutorial aims to teach the user how to integrate his native Android app with Appgain.io cloud using appgain.io SDK and how to use the appgain.io products

Android Studio uses Gradle (an advanced build toolkit) to automate and manage the build process while allowing you to define flexible custom build configurations. You can refer to Android Studio’s Build Guide for additional details.

Prerequisites

  • Android Studio.

  • Mobile App Project created on Appgain.io dashboard.

Installing SDK

  1. go to https://firebase.google.com/ and log in with a Google Account.

  2. At Firebase Website, in the right corner click on GO TO CONSOLE and click on Add Project , then give your Project a name.

  3. Click on the settings icon next to Project Overview and then click on Project Settings

  4. Click on GENERAL > Add Firebase to your Android app icon , fill in the fields with :

  5. your _Android package name : you can find it
    under application Id in app/build.gradle
  6. Debug signing certificate SHA- 1 you can get it from :

    • Gradle menu in right toolbar of android studio
    • Click on app menu
    • Click on android menu
    • Click on android on signingReport tas
    • Get SHA1 from run menu
  7. and click on REGISTER APP.

  8. Download google-services.json file
  9. Add google-services.json file under app folder in your android project files
  10. open your app/build.gradle file and add following lines under dependencies:
   dependencies {
  implementation 'io.appgain:sdk:1.1.0'
  implementation 'com.github.parse-community:Parse-SDK-Android:1.18.5'
  implementation "com.github.parse-community.Parse-SDK-Android:fcm:1.18.5"
  implementation 'com.squareup.retrofit2:retrofit:2.3.0'
  implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
  implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
  implementation 'com.jakewharton.timber:timber:3.1.0'
}
  • open your project/build.gradle file and add following line under dependencies
 dependencies {  
classpath 'com.google.gms:google-services:4.1.0'  
}

  • in the end of your app/build.gradle file add the following line
   apply plugin: 'com.google.gms.google-services'
  • update your manifest permissions

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

  • make new class called AppController which extend Application

  • add those lines into oncreate metchod


 AppgainSDKInitCallBack callback = new AppgainSDKInitCallBack() {  

@Override  
public void onSuccess() {  
Log.e(TAG , "success initialization");  
}  

@Override  
public void onFail(BaseResponse failure) {  
Log.e(TAG , "faille initialization");  
}  
};  

Appgain.initialize(getApplicationContext() ,APPGAIN_APP_ID , APPGAIN_API_KEY , callback);

  • Add your new class name in name attribute inside application tag in your manifest file.