Titanium Android module for AppLovin Ads platform.
Please note that if your androidManifest has screen support set to: android:anyDensity="false", any banner ads will display too small on high density devices. It is not clear at this point if this is a bug with AdMob or Titanium. In any event, you will either need to NOT set your screen support -- or set android:anyDensity="true" and adjust your app layout accordingly
View the Using Titanium Modules document for instructions on getting started with using this module in your application.
For Ti.Android.AppLovin 1.0.0
- Titanium SDK 10.0.0+
You can get it here
First you need add this meta-data to your tiapp.xml
<android>
<manifest>
<application android:hardwareAccelerated="true" tools:replace="android:hardwareAccelerated">
<meta-data xmlns:tools="http://schemas.android.com/tools" tools:replace="android:value" android:name="applovin.sdk.key" android:value="lZ2EfUPNmdDD1ESDERYDNlxUrZvTEoN_TP4nFrgtJDT0eaWIlZFRGTYMbXUczRftnsGFSZI5QMKoVhZRftrG"/>
</application>
</manifest>
</android>
You need to require the module
var AppLovin = require("ti.android.applovin");
let banner = AppLovin.createBanner({
// Specific
adUnitId: "edfo454ofidos", //USE YOUR AD_UNIT ID HERE
adBackgroundColor: "#FFFFFF",
adHeight: 50,
// Standard View parameters
bottom: 0
});
window.add(banner);
// Medium Rectangles are always 300x250
let mrec = AppLovin.createMrec({
// Specific
adUnitId: "edfo454oduiro", //USE YOUR AD_UNIT ID HERE
adBackgroundColor: "#000000",
// Standard View parameters
bottom: 0
});
window.add(mrec);
var interstitial = AppLovin.createInterstitial({
adUnitId : 'edfo4534fusir1', //USE YOUR AD_UNIT ID HERE
});
interstitial.addEventListener(AppLovin.AD_LOADED, function() {
Titanium.API.warn("Interstital Ad Received");
interstitialAd.show();
});
interstitial.addEventListener(AppLovin.AD_HIDDEN, function() {
Titanium.API.warn("Interstital ad close successfully. RIP!");
interstitial.load();
});
var rewarded = AppLovin.createRewarded({
adUnitId: 'edfa384fcsdr3', //USE YOUR AD_UNIT ID HERE
});
rewarded.addEventListener(AppLovin.AD_LOADED, function(e) {
Titanium.API.info("Rewarded Ad AD_LOADED");
rewarded.show();
});
rewarded.addEventListener(AppLovin.USER_REWARDED, function(e) {
Titanium.API.info("Rewarded Ad USER_REWARDED");
Titanium.API.info("Yay! You can give the user his reward now!");
rewarded.load();
});
Events | Description |
---|---|
AD_LOADED | Ad have successfully loaded. |
AD_LOAD_FAILED | Ad failed to load. |
AD_DISPLAYED | Ad had been successfully displayed after loading. |
AD_HIDDEN | Ad has been successfully hidden. |
AD_DISPLAY_FAILED | Ad failed to be displayed after loading. |
AD_CLICKED | Clicked has been registered by AppLovin |
AD_EXPANDED | Some ads expand when clicked, and this is the successfull callback for it. |
AD_COLLAPSED | Fired after a expanded ad have been closed and colapsed. |
AD_NOT_READY | Fired when you try to show an Interstitial or Rewarded ad that haven't been lodaded yet. |
REWARDED_VIDEO_STARTED | Fires when the rewarded video starts |
USER_REWARDED | Rewared granted! You can now rewarded the user |
REWARDED_VIDEO_COMPLETED | Fires when the rewarded video ends |
When you use the AppLovin SDK, you are responsible for maintaining compliance with applicable privacy regulations. If you collect and/or transmit personally identifiable information on your own, you are responsible for protecting and managing that data. Similarly, you are fully responsible for correctly collecting and passing consent values and age-related flags to AppLovin, whether you are using your own consent mechanism or a third-party API. AppLovin provides developer APIs for passing applicable consent and age-related flags. Best practices:
- Solicit your own legal advice. Nothing in this document should be construed as legal advice.
- Read and understand AppLovin Policies for Publishers, AppLovin’s Privacy Policy, and integration guides offered by AppLovin.
- List AppLovin as a third-party which collects data in your privacy policy, and include a link to AppLovin in your privacy policy. This framework helps facilitate compliance with the General Data Protection Regulation (“GDPR”), certain California privacy requirements, and various children data restrictions under GDPR, COPPA, and App Store policies. However, consent and privacy requirements may extend beyond these circumstances and should be applied accordingly.
If the user does not consent to interest-based advertising, set the user consent flag to false by calling setHasUserConsent for a particular user, and start requesting ads through the AppLovin SDK. After you set the consent value to false, AppLovin will continue to respect that value for the lifetime of your application or until the user consents to interest-based advertising. You must ensure you have set the consent flag correctly. If you set the consent flag correctly, the “Has User Consent” value shown in the logs will be either “true” or “false.” As described above, after you set the consent value, AppLovin will continue to respect that value for the lifetime of your application or until the consent value changes.
California law may require you to display a “Do Not Sell or Share My Personal Information” link or provide other options to users located in the State of California. You must set a flag that indicates whether a California-based user has opted out of a sale or share of personal information for interest-based advertising.
If you know that the user does not fall within an age-restricted category (i.e., age 16 or older, or as otherwise defined by applicable laws), you must set the age-restricted user flag to false.