Integration

Apptics' Flutter SDK is a wrapper around Apptics' native iOS and Android SDK. At the moment, Apptics' Flutter SDK supports the below mentioned:

  • In-app Events
  • Screens
  • Sessions
  • In-app Ratings
  • In-app Updates
  • Remote Configuration

Install Apptics

  • Run the below command with Flutter:
Copied$ flutter pub add apptics_flutter ^0.0.6
  • This will add a line to your package's pubspec.yaml (and run an implicit flutter pub get):

NOTE: Make sure that your editor supports flutter pub get.

Copieddependencies:
  apptics_flutter: ^0.0.6

Initialize Apptics

You need to perform the platform-specific initialization steps.

Apple

  • Register your app in the Apptics console and download the apptics-config.plist. Refer to our user guide here.
  • Move the file into the Xcode project root folder and add the config file to the main target.
  • Add the pre-build script to your podfile.

To add a run script via the podfile, use the below.

Copiedsource 'https://github.com/CocoaPods/Specs.git'
  target 'MAIN TARGET' do

    # Pre build script will register the app version, upload dSYM file to the server and add apptics specific information to the main info.plist which will be used by the SDK.
    script_phase :name => 'Apptics pre build', :script => 'sh "./Pods/Apptics-SDK/scripts/run" --upload-symbols-for-configurations="Release, Appstore"', :execution_position => :before_compile

  end

You can also add the run script manually. Follow the below steps.

  • Select your project in the project navigator.
  • Select the target you want to modify.
  • Click on Build phases. Click the + icon and choose the New Run Script Phase from the pop-up. Rename the new run script phase as Apptics pre build.
  • Click on the disclosure triangle for the newly added run script phase.
  • In the shell text field add the below script.

sh "./Pods/Apptics-SDK/scripts/run" --upload-symbols-for-configurations="Release, Appstore"

Important:  

  • Adding the pre-build script is mandatory.
  • In the pre-build script, we upload dSYM to the server (optional), register the app with the Apptics server, and add the necessary information of the app version into the apptics-config.plist. Which is then used by the SDK to send the data to the Apptics server.
  • Always make sure the 'Copy Bundle Resources' is below the 'Compile Sources' and the '[cp-user] Apptics pre build' is above the 'Compile Sources'.

Build script usage:

run --upload-symbols-for-configurations="Release, Appstore" --config-file-path="YOUR_PATH/apptics-config.plist" --app-group-identifier="group.com.company.application [Optional]"

  • --config-file-path pass your config file path if it is not added to your project root.
  • --app-group-identifier if you have enabled app group identifier for your app's target.
  • --upload-symbols-for-configurations string, an optional parameter to pass your configuration name debug, release, or add a custom name with comma-separated for which the dSYMs will be uploaded without any prompt during App Store submission process via CI, CT, and CD.
  • For more details on how to configure multiple projects refer the SDK guide.
  • Build the Xcode project and check for any issues.

Android

  • Register your app in the Apptics console and download the apptics-config.plist. Refer to our User guide here.
  • Place apptics-config.json file in the app/ directory (Root of the Android Studio app module).
  • Add apptics-plugin classpath and zoho maven url in the project level build.gradle
Copiedbuildscript {
    repositories {
        maven {
            url "https://maven.zohodl.com/"
        }
    }
    dependencies {
        classpath "com.zoho.apptics:apptics-plugin:0.1.2"
    }
}
allprojects {
    repositories {
        maven {
            url "https://maven.zohodl.com/"
        }
    }
  • Apply apptics-plugin in-app level build.gradle file (app/build.gradle).
Copiedapply plugin: "com.android.application"
apply plugin: "apptics-plugin"