Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appodeal gideros plugin #4

Merged
merged 3 commits into from
Mar 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Ads/example/GiderosProject/appodeal.lua
Original file line number Diff line number Diff line change
@@ -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)
21 changes: 21 additions & 0 deletions Ads/source/Android/ExampleManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,26 @@
<meta-data android:name="applovin.sdk.key" android:value="foTTHR80e36XxXglVHsIhmTAJfaBwTPZKu7cJGdyJkUFG9-mRr37abIvFt49QUkmMsNg6_dQi6gzFekhTnq3M6" />
<activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
<activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />

<activity android:name="com.appodeal.ads.AdActivity"
android:configChanges="orientation|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.appodeal.ads.LoaderActivity"
android:configChanges="orientation|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />

<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Translucent" />
<activity android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />

<activity android:name="org.nexage.sourcekit.mraid.MRAIDBrowser"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
</manifest>
Binary file added Ads/source/Android/libs/android-support-v4.jar
Binary file not shown.
Binary file added Ads/source/Android/libs/appodeal.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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<Activity> sActivity;
private String adsID;
private AdsManager mngr;
static AdsAppodeal me;

public void onCreate(WeakReference<Activity> 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<String> param = (SparseArray<String>)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() {}

}