Android SDK
Install Using Android Studio
Open the Project Structure dialog (
File > Project Structure...).Choose
Dependenciesfrom the left pane, then the main module (e.g.app).Click the
+button in theDeclared Dependenciespane, and choose1 Library Dependencyfrom the popup menu to open theAdd Library Dependencydialog.In the
Add Library Dependencydialog, typexyz.spindlunder Step 1 and press theSearchbutton.Choose the
xyz.spindl|sdkresult from the results table, and the highest version available.Make sure
implementationis selected under Step 2, and pressOK.
Initialize SDK
Setup a Spindl instance, e.g. in MainActivity:
class MainActivity : ComponentActivity() {
private lateinit var spindl: Spindl
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val apiKey = getString(R.string.spindlApiKey)
lifecycleScope.launch {
spindl = Spindl(context = applicationContext, lifecycleOwner = this@MainActivity)
spindl.initialize(apiKey = apiKey)
}
...Track Events
Track events with the track method:
nameis requiredpropertiesare optional
val properties = JsonObject()
properties.addProperty("prop1Key", "prop1Value")
spindl.track("eventName", properties)Identify Users
Once customers enter their customer ID (such as email) and/or wallet information (e.g., after logging in), connect that to the analytics by calling the identify method:
spindl.identify(walletAddress = wallet, customerUserId = userId)Last updated