Skip to content

Android Integration

The Android SDK is a wrapper over our Web application.

The SDK wraps the webapp and take care of concerns like

  1. Back navigation
  2. UPI Intent handling for payments

Usage

  1. Add Jitpack repository to your project’s Gradle file
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") } //Add this line
}
}
  1. Add the dependency to your Gradle file.
dependencies {
implementation ("money.myhubble:storesdk:0.0.3")
}
  1. Initiate our SDK using the below code snippet.
Hubble.init(
env="dev", // If not given, will default to 'prod'
token="GOpBKIQ0xj", // Some token or ID that uniquely identifies your user
clientId= "clientA", // will be provided by Hubble team
clientSecret= "clientSecretA", // will be provided by Hubble team
)
  1. Now, to open the store, you can simply call
Hubble.open(context = context)

This will open a new activity and render Hubble’s SDK.

With fragments

  1. If you have a fragments based view, you can get Hubble fragment with the below code snipped.
hubbleFragment = Hubble.getFragment()
  1. When your activity receives a system back event when Hubble fragment is in view, you can instruct the fragment to navigate back using,
hubbleFragment.goBack() // true | false

goBack method returns true is Hubble sdk performed navigation. If user is on the root view of Hubble, i.e. the homepage, then goBack will return false.

Events

If you are interested in anaytics events, you can pass a callback to Hubble on initialization.

Whenever there is an event triggered within the SDK, Hubble will call this callback with the event name and properties.

Hubble.init(
...
onAnalyticsEvent = { eventName: String, props: Map<String, Any> ->
Log.i(tag, "Received event $eventName from Hubble SDK. ${props}")
}
)

Examples

  1. Activity - here
  2. Fragment - here

Changelog

VersionDateChangesBy
0.0.113 May 2024First versionYash Joshi
0.0.217 May 2024Support fragments and relay events back to native from webviewPriyanshu
0.0.322 May 2024Interface refactor and support for reloading the webviewSudhagar