Android SDK
Follow steps in this section to set up and start using Monetizr plugin for Android.
Requires Android SDK version 21+
Lollipop 5.0 and above
Installation
You can install Monetizr plugin via Gradle or Maven. Here's the link to Github.
Gradle install
Add build.gradle
file inside your application root folder to install. Add Monetizr plugin to the dependencies list. MavenCentral and Google are added to repositories by default but we still suggest to check if they are present.
repositories {
mavenCentral()
google()
}
dependencies {
...
implementation 'io.monetizr.monetizrsdk:MonetizrSDK:1.0.0'
...
}
Maven install
<dependency>
<groupId>io.monetizr.monetizrsdk</groupId>
<artifactId>MonetizrSDK</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
Using the plugin
Use the public test token 4D2E54389EB489966658DDD83E2D1
as apikey
to check connection and installation. This has to be done once before invoking Monetizr Offer View.
MonetizrSdk.apikey = "4D2E54389EB489966658DDD83E2D1"
Use showProductForTag
with test value T-shirt
to show Offer View:
MonetizrSdk.showProductForTag("T-shirt")
If everything works and you get response callback with test values then you can create Monetizr account and retrieve your access token. With it, you can show and sell custom products in your Android game. Note that apikey
needs to be updated once after every token change.
Enable debugging
You can opt-in and enable debugging mode by specifying debuggable
property to true
. This property will print out messages to Logcat window in Android Studio. With property set to false
(default setting) it will ignore error messages and will not interact with host application.
MonetizrSdk.debuggable = true
Required permissions:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Updated 8 months ago