Getting Started

Integration

The minSdkVersion version number in your build.gradle should not be less than 21.

To integrate the SDK into your app, please follow the following steps:

  1. Add this dependency to your project’s build.gradle at the end of repositories:
allprojects {
   repositories {
       maven (url = uri("https://jitpack.io"))
   }
}
allprojects {
   repositories {
      maven {
         url 'https://jitpack.io'
      }
   }
}
  1. Add the dependency:
dependencies {
   implementation ("com.github.Teavaro:FunnelConnect-Mobile-SDK:LATEST_VERSION")  {
            exclude("com.github.Teavaro.FunnelConnect-Mobile-SDK", "core-android")
   }
}
dependencies {
   implementation 'com.github.Teavaro:FunnelConnect-Mobile-SDK:LATEST_VERSION'  {
            exclude group: "com.github.Teavaro.FunnelConnect-Mobile-SDK",  module: "core-android"
   }
}

You can get the latest version from here.

Initializing the SDK

Basic initializing

Assuming that you have an application class registered in the AndroidManifest.xml file, you can call the initialize function inside override fun onCreate(), passing the application context and the SDK token that you will get when you create a new app from the FunnelConnectSDK sign up console.

FunnelConnectSDK.initialize(this,"test123", R.raw.config_file)
FunnelConnectSDK.initialize(this, "test123", R.raw.config_file);

The config file and the token will be sent to you once you register your app.

Initializing with custom options

FCOptions() is an optional initialization parameter, so you can initialize the SDK without passing it, but in case there are options that you want to specifically enable or disable, this can be done by passing custom options object to the initializer.

Currently, enable debugging is the only available option, but there will be more in the future..

val options = FCOptions(enableLogging = true)
FunnelConnectSDK.initialize(this, "test123", R.raw.config_file, options)
FCOptions options = new FCOptions(true);
FunnelConnectSDK.initialize(this, "test123", R.raw.config_file, options);

Check if the SDK is initialized

At some point, you will want to check if the SDK is initialized before doing anything else.

Boolean check

 FunnelConnectSDK.isInitialized()
 FunnelConnectSDK.isInitialized();

onInitialize listener

FunnelConnectSDK.onInitialize({
   // Success Action
}) {
   // Failure Action
}
FunnelConnectSDK.onInitialize(() -> {
       // Success Action
}, error -> {
       // Failure Action
}); 

you would need to do this if you want to do something with the SDK very early (for example in the splash screen) and you want to make sure that the SDK is initialized before doing anything with the SDK, however if you will use the SDK services in a class that will require going through multiple steps, such as the cart page in an e-commerce app, most probably you won’t need to use these function because the SDK will be already initialized by the time of reaching to that page or class, so it is your call to decide when to use that check and when not to.

Clear cache

Cached data and cookies can be cleared easily using the following functions.

FunnelConnectSDK.clearData()
FunnelConnectSDK.clearCookies()
FunnelConnectSDK.clearData();
FunnelConnectSDK.clearCookies();

Basic usage

Once the SDK is initialized, all the services functions can be called by calling FunnelConnectSDK. to access the SDK functions.

Support and bug reporting

If you have any suggestions or you want to report a bug or ask a question, please create a new issue in this repository.

You can also check if there is a similar issue to yours that has been solved before.