Android SDK Installation
Follow these steps to add the Magify Android SDK to your project.
Requirements
Build environment
Downloading Magify SDK
Download the latest SDK package from the Releases page.
After downloading the package, unzip the archive.
Adding the local repository
Add the unzipped SDK folder to the libs directory at the project level.
If the libs folder does not exist, create it.
Configuring the root build file
Open your root build.gradle file and add the local Maven repository:
repositories {
...
mavenLocal()
maven {
url = uri("${rootDir}/libs")
}
}
Adding the SDK dependency
Open your module build.gradle file and add the SDK dependency.
Use the SDK version included in the package you downloaded.
dependencies {
...
implementation("com.magify:sdk:x.x.x")
}
Sync your project.
Libraries
The Magify Android SDK uses the following libraries:
Minimum integration
The following steps provide the minimum required setup to initialize the SDK.
1. Add the configuration file
Download Magify-Config.json from the Magify Dashboard, or use the dummy configuration below for local development and testing.
Add the file to your Android application's assets directory.
2. Initialize and call setup
import com.magify.sdk.Magify
// Application class
lateinit var magify: Magify
override fun onCreate() {
val config = MagifyConfig(
applicationName = "android-application", // short app name as listed in the dashboard
defaultConfig = "Magify-Config.json", // only limits and products are expected in the config
isSandbox = false // set to true only for sandbox environment
)
magify = Magify.createInstance(androidApp, config)
// Optional flags — configure before calling setup()
magify.turnOffGeoIP = true
magify.isLoggingEnabled = true
magify.initSdk(
complete = {
// track sdk initialization
}
)
magify.initialSetup()
}
3. Configure clientId
Optionally, provide a custom clientId during SDK initialization.
val config = MagifyConfig(
...
userId = "custom_client_id",
...
)
4. Track purchases
Set the subscription status directly:
magify.subscriptionStatus = SubscriptionState.ACTIVE_PAID
The in-app purchase status (inAppStatus) is read-only. It updates automatically when you report in-app purchases.
See the Purchases section for tracking in-app, external, and trusted purchases.
5. Sync third-party SDKs
Synchronize attribution data with your MMP, such as AppsFlyer or Adjust.
magify.mediaSource = MediaSource(
network = "appsflyer",
campaign = "ua_01",
adGroup = "us"
)
Dummy Magify-Config.json
Use this file for local development and testing before receiving the production configuration from the Magify Dashboard.
{
"limits": {
"impression_per_session_limit": null,
"sessions_interval": null,
"global_interval": null,
"interstitial_interval": null
},
"native_elements": [],
"campaigns": [],
"features": {},
"content": {}
}
Releases
See the Releases page for the SDK version history and release notes.
Next step
Now that the SDK is installed, you can proceed to the Configuration section to customize the SDK behavior for your application.