diff --git a/Ads/example/GiderosProject/appodeal.lua b/Ads/example/GiderosProject/appodeal.lua new file mode 100644 index 0000000..cf2f40e --- /dev/null +++ b/Ads/example/GiderosProject/appodeal.lua @@ -0,0 +1,28 @@ +ads = Ads.new("appodeal") +--note:Bundle must match bundle_id in your app on Appodeal.com +ads:setKey("fee50c333ff3825fd6ad6d38cff78154de3025546d47a84f") +ads:showAd("auto") + +ads:addEventListener(Event.AD_RECEIVED, function() + print("ads AD_RECEIVED") +end) + +ads:addEventListener(Event.AD_FAILED, function(e) + print("ads AD_FAILED", e.error) +end) + +ads:addEventListener(Event.AD_ACTION_BEGIN, function() + print("ads AD_ACTION_BEGIN") +end) + +ads:addEventListener(Event.AD_ACTION_END, function() + print("ads AD_ACTION_END") +end) + +ads:addEventListener(Event.AD_DISMISSED, function() + print("ads AD_DISMISSED") +end) + +ads:addEventListener(Event.AD_ERROR, function(e) + print("ads AD_ERROR", e.error) +end) \ No newline at end of file diff --git a/Ads/source/Android/ExampleManifest.xml b/Ads/source/Android/ExampleManifest.xml index b1bc728..9cdbfaa 100644 --- a/Ads/source/Android/ExampleManifest.xml +++ b/Ads/source/Android/ExampleManifest.xml @@ -85,5 +85,26 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Ads/source/Android/libs/android-support-v4.jar b/Ads/source/Android/libs/android-support-v4.jar new file mode 100644 index 0000000..65ebaf8 Binary files /dev/null and b/Ads/source/Android/libs/android-support-v4.jar differ diff --git a/Ads/source/Android/libs/appodeal.jar b/Ads/source/Android/libs/appodeal.jar new file mode 100644 index 0000000..bd745bd Binary files /dev/null and b/Ads/source/Android/libs/appodeal.jar differ diff --git a/Ads/source/Android/src/com/giderosmobile/android/plugins/ads/frameworks/AdsAppodeal.java b/Ads/source/Android/src/com/giderosmobile/android/plugins/ads/frameworks/AdsAppodeal.java new file mode 100644 index 0000000..a2761d5 --- /dev/null +++ b/Ads/source/Android/src/com/giderosmobile/android/plugins/ads/frameworks/AdsAppodeal.java @@ -0,0 +1,102 @@ +package com.giderosmobile.android.plugins.ads.frameworks; + +import java.lang.ref.WeakReference; + +import android.app.Activity; +import android.util.Log; +import android.util.SparseArray; +import android.view.KeyEvent; + +import com.appodeal.ads.Appodeal; +import com.appodeal.ads.AppodealCallbacks; +import com.giderosmobile.android.plugins.ads.*; + +public class AdsAppodeal implements AdsInterface{ + + private WeakReference sActivity; + private String adsID; + private AdsManager mngr; + static AdsAppodeal me; + + public void onCreate(WeakReference activity) + { + me = this; + sActivity = activity; + mngr = new AdsManager(); + } + + //on destroy event + public void onDestroy() + { + mngr.destroy(); + } + + public void onStart(){} + + public void onStop(){} + + public void onPause(){} + + public void onResume(){} + + public boolean onKeyUp(int keyCode, KeyEvent event) { + return false; + } + + public void setKey(final Object parameters){ + SparseArray param = (SparseArray)parameters; + adsID = param.get(0); + final String TAG = "Appodeal"; + Appodeal.initialize(sActivity.get(), adsID, new AppodealCallbacks(){ + @Override + public void onAdLoaded() { + Log.d(TAG, "onAdLoaded"); + } + + @Override + public void onAdFailedToLoad() { + Log.d(TAG, "onAdFailedToLoad"); + } + + @Override + public void onAdShown() { + Log.d(TAG, "onAdShown"); + } + + @Override + public void onAdClicked() { + Log.d(TAG, "onAdClicked"); + } + + @Override + public void onAdClosed() { + Log.d(TAG, "onAdClosed"); + } + }); + } + + public void loadAd(final Object parameters){} + + public void showAd(final Object parameters) + { + if (Appodeal.isLoaded()) + Appodeal.showBanner(sActivity.get()); + } + + public void hideAd(String type) + { + mngr.hide(type); + } + + public int getWidth(){ + return 0; + } + + public int getHeight(){ + return 0; + } + + @Override + public void enableTesting() {} + +}