ReplaceLATEST_VERSION_NUMBERwith the latest version from our Github Tags page.
Initialize SDK
To initialize Apphud SDK you will need API Key. It is a unique identifier of your Apphud application. You can get it in your Apphud application settings under General tab.
Basic initialization looks like this:
Kotlin
Java
1
Apphud.start(this,"API_KEY")
Copied!
1
Apphud.start(this,"API_KEY");
Copied!
For using Apphud SDK in Observer mode, follow this link.
Initialize with Custom User ID
There is additional parameter which sets custom user id:
Kotlin
Java
1
Apphud.start(this,"API_KEY","custom_user_id")
Copied!
1
Apphud.start(this,"API_KEY","custom_user_id");
Copied!
More information regarding User ID uniqueness and User merging can be found here.
Configure Real-time Developer Notifications
Make sure you have correctly set up Google Real-time Developer Notifications. It helps to detect in-app purchase events in real-time. Read more here.
Handle In-App Purchases
You are not required to use Apphud purchase method. If you purchase products by yourself, then you should sync purchases with Apphud. So there are two options:
At the launch of the app Apphud automatically fetches SKU Details for products that are added in Apphud dashboard. You can set ApphudListener and implement the following method: