Getting Started

How to integrate the Apps Panel SDK bridge in your app

The Apps Panel SDK is made to work with the Apps Panel Back Office. It provides a set of tools making your development easier and permitting to access all the features developed by Apps Panel.

The following information explain how to get started by implementing the SDK in your app.

Flutter dependance

In order to use the Apps Panel SDK features, you need to add the git repository in the pubspec.yaml.

dependencies:
	flutter_appspanel:
    git:
      url: ssh://[email protected]:2222/sdk-mobile/sdkmobile-flutter.git
      ref: 1.0.0-beta.4

Android installation

  • Add all SDK environments configurations from product flavors settings :
android {
    ...
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        profile {
            signingConfig signingConfigs.debug
        }
        release {
            signingConfig signingConfigs.debug
            //signingConfig signingConfigs.release Keystore signing settings
        }
    }

    flavorDimensions "env"
		productFlavors {
        dev {
            dimension "env"
            buildConfigField "String", "AP_SDK_NAME", "\"myproject-dev\""
            buildConfigField "String", "AP_SDK_KEY", "\"AbCdEfGhIjKlMnOpQrStUvWxYz\""
            buildConfigField "String", "AP_SDK_PRIVATE", "\"AbCdEfGhIjKlMnOpQrStUvWxYz\""
            resValue "string", "app_name", "My Project DEV"
            applicationIdSuffix ".dev"
        }
        qa {
            dimension "env"
            buildConfigField "String", "AP_SDK_NAME", "\"myproject-qa\""
            buildConfigField "String", "AP_SDK_KEY", "\"AbCdEfGhIjKlMnOpQrStUvWxYz\""
            buildConfigField "String", "AP_SDK_PRIVATE", "\"AbCdEfGhIjKlMnOpQrStUvWxYz\""
            resValue "string", "app_name", "My Project QA"
            applicationIdSuffix ".qa"
        }
        prod {
            dimension "env"
            buildConfigField "String", "AP_SDK_NAME", "\"myproject-prod\""
            buildConfigField "String", "AP_SDK_KEY", "\"AbCdEfGhIjKlMnOpQrStUvWxYz\""
            buildConfigField "String", "AP_SDK_PRIVATE", "\"AbCdEfGhIjKlMnOpQrStUvWxYz\""
            resValue "string", "app_name", "My Project"
        }
    }
}
  • Create a MainApplication.kt file inside kotlin/com/myproject/app/ folder if not yet present and complete code as below :
package com.myproject.app

import android.content.Context
import android.util.Log
import io.flutter.app.FlutterApplication

import com.appspanel.flutter_appspanel.FlutterAPLocalConfiguration
import com.appspanel.flutter_appspanel.FluttersAppsPanelModuleBuilder

class MainApplication : FlutterApplication() {

    override fun attachBaseContext(base: Context) {
        super.attachBaseContext(base)
        val appsPanelConfiguration = FlutterAPLocalConfiguration(
            BuildConfig.AP_SDK_NAME,
            BuildConfig.AP_SDK_KEY,
            BuildConfig.AP_SDK_PRIVATE
        )
        Log.i("JME", "SDK install...")
        FluttersAppsPanelModuleBuilder.init(this, appsPanelConfiguration);
    }
}
  • Next, you have to add android:name=".MainApplication" to your AndroidManifest.xml.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.myproject.app">
   <application
       android:name=".MainApplication"
        android:label="My project"
        android:icon="@mipmap/ic_launcher">

iOS configuration

//TODO

Refer to iOS Getting started (v5) :
https://appspanel.readme.io/docs/ios-getting-started-v5

and Création app iOS

https://gitlab.apnl.tech/ap/docs/-/wikis/Cr%C3%A9ation-app-iOS

Build & run

Create a build configuration and specify your environment from the gradle build variant by adding arguments.
Corresponding commands :

flutter build apk --flavor=dev  	#for dev
flutter build apk --flavor=qa	  	#for quality assurance
flutter build apk --flavor=prod 	#for production build

For more information about Android specifications refer to the Android Getting Started (v5) documentation available from the link below :
https://appspanel.readme.io/docs/android-getting-started

Test

To be sure your SDK is correctly implemented check the back office web services logs to verify SDK requests at application startup.

Moreover, you can check Logcat dev logs with "JME" tag :

2021-10-28 17:08:34.767 24966-24966/com.myproject.app.dev I/JME: SDK install...
2021-10-28 17:08:34.767 24966-24966/com.myproject.app.dev D/JME: setConfiguration OK
2021-10-28 17:08:35.248 24966-24966/com.myproject.app.dev D/JME: initSDK
2021-10-28 17:08:35.248 24966-24966/com.myproject.app.dev D/JME: pluginBinding OK
2021-10-28 17:08:35.248 24966-24966/com.myproject.app.dev D/JME: APSDK.install()
2021-10-28 17:08:35.772 24966-25092/com.myproject.app.dev D/JME: APCrashManager init
2021-10-28 17:08:35.781 24966-25092/com.myproject.app.dev D/JME: postDevice
2021-10-28 17:08:35.787 24966-24966/com.myproject.app.dev D/JME: patchDevice
2021-10-28 17:08:37.258 24966-24966/com.myproject.app.dev D/JME: textManager