-
Notifications
You must be signed in to change notification settings - Fork 1
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
AppLovin/internal advanced bidding #2
base: master
Are you sure you want to change the base?
Changes from 9 commits
05226df
8d11d4f
b352217
3c00d83
58adcca
b97fc2c
829ce9d
a639539
ad1729f
7a491a2
eb75a4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.applovin.mediation; | ||
|
||
import com.google.android.gms.ads.reward.RewardItem; | ||
|
||
/** | ||
* Created by Thomas So on July 17 2018 | ||
*/ | ||
public final class AppLovinRewardItem | ||
implements RewardItem | ||
{ | ||
private final int mAmount; | ||
private final String mType; | ||
|
||
public AppLovinRewardItem(int amount, String type) | ||
{ | ||
mAmount = amount; | ||
mType = type; | ||
} | ||
|
||
@Override | ||
public String getType() | ||
{ | ||
return mType; | ||
} | ||
|
||
@Override | ||
public int getAmount() | ||
{ | ||
return mAmount; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
package com.applovin.mediation.rtb; | ||
|
||
import android.app.Application; | ||
import android.text.TextUtils; | ||
import android.util.Log; | ||
|
||
import com.applovin.mediation.AppLovinUtils; | ||
import com.applovin.sdk.AppLovinSdk; | ||
import com.google.ads.mediation.sample.adapter.BuildConfig; | ||
import com.google.android.gms.ads.AdSize; | ||
import com.google.android.gms.ads.mediation.rtb.AdRenderingCallback; | ||
import com.google.android.gms.ads.mediation.rtb.BannerAd; | ||
import com.google.android.gms.ads.mediation.rtb.BannerEventListener; | ||
import com.google.android.gms.ads.mediation.rtb.InterstitialAd; | ||
import com.google.android.gms.ads.mediation.rtb.InterstitialEventListener; | ||
import com.google.android.gms.ads.mediation.rtb.RewardedAd; | ||
import com.google.android.gms.ads.mediation.rtb.RewardedEventListener; | ||
import com.google.android.gms.ads.mediation.rtb.RtbAdConfiguration; | ||
import com.google.android.gms.ads.mediation.rtb.RtbAdapter; | ||
import com.google.android.gms.ads.mediation.rtb.RtbConfiguration; | ||
import com.google.android.gms.ads.mediation.rtb.RtbSignalData; | ||
import com.google.android.gms.ads.mediation.rtb.SignalCallbacks; | ||
import com.google.android.gms.ads.mediation.rtb.VersionInfo; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by Thomas So on July 17 2018 | ||
*/ | ||
public class AppLovinRtbAdapter | ||
extends RtbAdapter | ||
{ | ||
private static final String TAG = "AppLovinRtbAdapter"; | ||
|
||
// TODO: Why is this not in the base adapter?! | ||
// @Override | ||
// public void setUp() | ||
// { | ||
// AppLovinSdk.getInstance( new Application() ).initializeSdk(); | ||
// } | ||
|
||
@Override | ||
public void initialize() | ||
{ | ||
AppLovinSdk.getInstance( new Application() ).initializeSdk(); | ||
} | ||
|
||
@Override | ||
public void updateConfiguration(final List<RtbConfiguration> list) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: Waiting on AdMob for action on this. |
||
{ | ||
super.updateConfiguration( list ); | ||
} | ||
|
||
@Override | ||
public VersionInfo getSdkVersion() | ||
{ | ||
String versionString = AppLovinSdk.VERSION; | ||
String splits[] = versionString.split( "\\." ); | ||
int major = Integer.parseInt( splits[0] ); | ||
int minor = Integer.parseInt( splits[1] ); | ||
int patch = Integer.parseInt( splits[2] ); | ||
|
||
return new VersionInfo( major, minor, patch ); | ||
} | ||
|
||
@Override | ||
public VersionInfo getAdapterVersion() | ||
{ | ||
String versionString = BuildConfig.VERSION_NAME; | ||
String splits[] = versionString.split( "\\." ); | ||
int major = Integer.parseInt( splits[0] ); | ||
int minor = Integer.parseInt( splits[1] ); | ||
// Adapter versions have 2 patch versions. Multiply the first patch by 100. | ||
int micro = Integer.parseInt( splits[2] ) * 100 + Integer.parseInt( splits[3] ); | ||
|
||
return new VersionInfo( major, minor, micro ); | ||
} | ||
|
||
@Override | ||
public void collectSignals(RtbSignalData rtbSignalData, SignalCallbacks signalCallbacks) | ||
{ | ||
// TODO: I hope that we do not use the SDK Key and Context from here to initialize SDK / get bid token with... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we would be initializing the SDK here. We initialize it in either
So, we should not be doing any heavy duty work here and try to callback with a bid token ASAP. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand, but we can't initialize our SDK in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, makes sense. Didn't notice that they were not providing |
||
// Check if the publisher provided extra parameters | ||
if ( rtbSignalData.extras != null ) | ||
{ | ||
Log.i( TAG, "Extras for signal collection: " + rtbSignalData.extras ); | ||
} | ||
|
||
AppLovinSdk sdk = AppLovinUtils.retrieveSdk( rtbSignalData.extras, rtbSignalData.context ); | ||
String bidToken = sdk.getAdService().getBidToken(); | ||
|
||
if ( !TextUtils.isEmpty( bidToken ) ) | ||
{ | ||
Log.i( TAG, "Generated bid token: " + bidToken ); | ||
signalCallbacks.onSuccess( bidToken ); | ||
} | ||
else | ||
{ | ||
Log.e( TAG, "Failed to generate bid token" ); | ||
signalCallbacks.onFailure( null ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a reason for failure in the failure callback? Maybe even the error message we are logging above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea I thought about that - more code - but why not! |
||
} | ||
} | ||
|
||
@Override | ||
public void renderBannerAd(RtbAdConfiguration adConfiguration, AdSize adSize, AdRenderingCallback<BannerAd, BannerEventListener> callback) | ||
{ | ||
AppLovinRtbBannerRenderer bannerRenderer = new AppLovinRtbBannerRenderer( adConfiguration, adSize, callback ); | ||
bannerRenderer.loadAd(); | ||
} | ||
|
||
@Override | ||
public void renderInterstitialAd(RtbAdConfiguration adConfiguration, AdRenderingCallback<InterstitialAd, InterstitialEventListener> callback) | ||
{ | ||
AppLovinRtbInterstitialRenderer interstitialRenderer = new AppLovinRtbInterstitialRenderer( adConfiguration, callback ); | ||
interstitialRenderer.loadAd(); | ||
} | ||
|
||
@Override | ||
public void renderRewardedAd(RtbAdConfiguration adConfiguration, AdRenderingCallback<RewardedAd, RewardedEventListener> callback) | ||
{ | ||
AppLovinRtbRewardedRenderer rewardedRenderer = new AppLovinRtbRewardedRenderer( adConfiguration, callback ); | ||
rewardedRenderer.loadAd(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this method in
RtbAdapter
in the latest version of the GMA SDK. I'm guessing that this method may have been dropped in favor ofinitialize()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:/ inconsistent with iOS - we are going to figure out what's up.