Android Integration
The Android SDK is a wrapper over our Web application.
The SDK wraps the webapp and take care of concerns like
- Back navigation
- UPI Intent handling for payments
Usage
- 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 }}
- Add the dependency to your Gradle file.
dependencies { implementation ("money.myhubble:storesdk:0.0.3")}
- 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)
- 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
- If you have a fragments based view, you can get Hubble fragment with the below code snipped.
hubbleFragment = Hubble.getFragment()
- 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}") })
Deeplinks
You may have a usecase where you want to open a brand page or some other page directly on sdk initialization.
You can do it through page
parameter when calling init
.
Hubble.init( ... page = HubblePage( page = "brand", params = mapOf("brandId" to "uber") ))
Currently we support opening three pages
- Brand page
brand
which also needs abrandId
parameter - Transaction history page
transactions
- Help & Support page
support
Examples
Changelog
Version | Date | Changes | By |
---|---|---|---|
0.0.1 | 13 May 2024 | First version | Yash Joshi |
0.0.2 | 17 May 2024 | Support fragments and relay events back to native from webview | Priyanshu |
0.0.3 | 22 May 2024 | Interface refactor and support for reloading the webview | Sudhagar |
0.0.4 | 26 Sep 2024 | Support for opening different pages | Priyanshu |