Skip to content

Commit

Permalink
SDK v8.2
Browse files Browse the repository at this point in the history
* commit '382f422db88565df869cf105783d240e2dd67c0a':
  Updated Release notes, sdk version to 8.2
  MS-5172 GPP implementation
  MS-5195 FAN upgrade
  MS-5190 NPE while loadAdFromVAST
  MS-5024 Update proguard rules instructions
  MS-5132 fix failing build for Simple Video
  MS-5132 Add boolean to notify success / failure in onInitFinished
  MS-5099 Added performance test cases
  • Loading branch information
avohraa committed Dec 1, 2022
2 parents 137c80f + 382f422 commit 3b59232
Show file tree
Hide file tree
Showing 33 changed files with 611 additions and 82 deletions.
11 changes: 11 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 8.2

### Improvement/Bug Fixes
+ MS-5172 Support for Global Privacy Platform (GPP) [https://docs.xandr.com/bundle/mobile-sdk/page/sdk-privacy-for-android.html]
+ MS-5132 Add a boolean to notify success / failure for XandrAd InitListener [Github #74][https://docs.xandr.com/bundle/mobile-sdk/page/android-sdk-initialization-v8-0.html]
+ MS-5024 Updated ProGuard settings [Github #65]
+ MS-5190 NullPointerException while using loadAdFromVAST for BannerAdView

### Mediation partner updates
+ MS-5195 Upgraded Facebook Audience Network SDK from 6.5.0 to 6.12.0

## 8.1

### Improvement/Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion csr/Facebook/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project Properties
version = "6.5.0" // supported Facebook version
version = "6.12.0" // supported Facebook version

apply plugin: 'com.android.library'

Expand Down
3 changes: 2 additions & 1 deletion examples/java/SimpleBanner/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<activity
android:name=".MyActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenLayout|screenSize|keyboardHidden">
android:configChanges="orientation|screenLayout|screenSize|keyboardHidden"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@
import android.os.Handler;
import android.util.Log;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.appnexus.opensdk.ANClickThroughAction;
import com.appnexus.opensdk.AdListener;
import com.appnexus.opensdk.AdView;
import com.appnexus.opensdk.BannerAdView;
import com.appnexus.opensdk.InitListener;
import com.appnexus.opensdk.NativeAdResponse;
import com.appnexus.opensdk.ResultCode;
import com.appnexus.opensdk.SDKSettings;
import com.appnexus.opensdk.XandrAd;
import com.appnexus.opensdk.utils.Clog;

public class MyActivity extends Activity {
Expand All @@ -39,6 +42,12 @@ public class MyActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
XandrAd.init(10094, this, true, new InitListener() {
@Override
public void onInitFinished(boolean success) {
Toast.makeText(MyActivity.this, "Init Completed with " + success, Toast.LENGTH_SHORT).show();
}
});

bav = new BannerAdView(this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ public void onCreate() {
super.onCreate();
XandrAd.init(10094, this, true, new InitListener() {
@Override
public void onInitFinished() {
Toast.makeText(getApplicationContext(), "Init Completed", Toast.LENGTH_SHORT).show();
public void onInitFinished(boolean success) {
Toast.makeText(getApplicationContext(), "Init Completed with " + success, Toast.LENGTH_SHORT).show();
}
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
SDKSettings.init(this, new InitListener() {
@Override
public void onInitFinished() {
public void onInitFinished(boolean success) {
infoText = (TextView) findViewById(R.id.infotTextView);
playButon = (ImageButton) findViewById(R.id.play_button);
videoPlayer = (VideoView) findViewById(R.id.video_player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ public void onCreate() {
super.onCreate();
XandrAd.init(10094, this, true, new InitListener() {
@Override
public void onInitFinished() {
Toast.makeText(getApplicationContext(), "Init Completed", Toast.LENGTH_SHORT).show();
public void onInitFinished(boolean success) {
Toast.makeText(getApplicationContext(), "Init Completed with " + success, Toast.LENGTH_SHORT).show();
}
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class MainApplication: Application() {
override fun onCreate() {
super.onCreate()
XandrAd.init(10094, this, true) {
Toast.makeText(this, "Init Completed", Toast.LENGTH_SHORT).show()
Toast.makeText(this, "Init Completed with $it", Toast.LENGTH_SHORT).show()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class MainApplication: Application() {
override fun onCreate() {
super.onCreate()
XandrAd.init(10094, this, true) {
Toast.makeText(this, "Init Completed", Toast.LENGTH_SHORT).show()
Toast.makeText(this, "Init Completed with $it", Toast.LENGTH_SHORT).show()
}
}
}
4 changes: 2 additions & 2 deletions instreamvideo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project Properties
version = "1.39" // Instream SDK version
version = "1.40" // Instream SDK version

apply plugin: 'com.android.library'

Expand All @@ -10,7 +10,7 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 32
versionCode 38 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 39 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionName version
consumerProguardFiles 'proguard-project.txt'
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project properties
version = "8.1"
version = "8.2"
group='com.appnexus.opensdk'

// Android build
Expand All @@ -9,7 +9,7 @@ android {
compileSdkVersion 32
buildToolsVersion '32.0.0'
defaultConfig {
versionCode 97 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 98 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionName version
consumerProguardFiles 'proguard-project.txt'
minSdkVersion 14
Expand All @@ -22,7 +22,7 @@ android {
main.res.srcDir 'res'
main.assets.srcDir 'assets'
main.resources.srcDir 'src'
test.manifest.srcFile 'AndroidManifestTest.xml'
// test.manifest.srcFile 'AndroidManifestTest.xml'
test.java.srcDir 'test'
}

Expand Down
28 changes: 6 additions & 22 deletions sdk/proguard-project.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,11 @@
-keep public class * implements com.appnexus.opensdk.MediatedNativeAd {public *;}
-keep public class * implements com.appnexus.opensdk.CSRAd {public *;}

# Uncomment for Google Play Services library
#-keep class * extends java.util.ListResourceBundle {
# protected Object[][] getContents();
#}
#
#-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
# public static final *** NULL;
# Uncomment to support for Android Advertiser ID.
#-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
# com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
#}
#
#-keepnames @com.google.android.gms.common.annotation.KeepName class *
#
#-keepclassmembernames class * {
# @com.google.android.gms.common.annotation.KeepName *;
#-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
# java.lang.String getId();
# boolean isLimitAdTrackingEnabled();
#}
#
#-keepnames class * implements android.os.Parcelable {
# public ** CREATOR;
#}

# Uncomment to support for Android Advertiser ID.
#-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
#-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {*;}


12 changes: 9 additions & 3 deletions sdk/src/com/appnexus/opensdk/ANGDPRSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public class ANGDPRSettings {
// Google ACM consent parameter
private static final String IABTCF_ADDTL_CONSENT = "IABTCF_AddtlConsent";

// GPP consent parameters
private static final String IABGPP_TCFEU2_SubjectToGDPR = "IABGPP_TCFEU2_gdprApplies";
private static final String IABGPP_TCFEU2_PurposeConsents = "IABGPP_TCFEU2_PurposeConsents";

/**
* Set the consent string in the SDK
*
Expand Down Expand Up @@ -173,6 +177,8 @@ public static Boolean getConsentRequired(Context context) {
subjectToGdprValue = pref.getString(ANGDPR_CONSENT_REQUIRED, "");
} else if (pref.contains(IAB_SUBJECT_TO_GDPR)) {
subjectToGdprValue = pref.getString(IAB_SUBJECT_TO_GDPR, "");
} else if (pref.contains(IABGPP_TCFEU2_SubjectToGDPR)) {
subjectToGdprValue = pref.getString(IABGPP_TCFEU2_SubjectToGDPR, "");
}
}

Expand Down Expand Up @@ -208,7 +214,9 @@ public static String getDeviceAccessConsent(Context context) {
if (pref.contains(IABTCF_PurposeConsents)){
deviceConsent = pref.getString(IABTCF_PurposeConsents, null);
}else if (pref.contains(ANGDPR_PurposeConsents)) {
deviceConsent = pref.getString(ANGDPR_PurposeConsents, null);
deviceConsent = pref.getString(ANGDPR_PurposeConsents, null);
} else if (pref.contains(IABGPP_TCFEU2_PurposeConsents)) {
deviceConsent = pref.getString(IABGPP_TCFEU2_PurposeConsents, null);
}

return !StringUtil.isEmpty(deviceConsent) ? deviceConsent.substring(0, 1) : null;
Expand All @@ -231,6 +239,4 @@ public static Boolean canIAccessDeviceData(Context context) {

return false;
}


}
12 changes: 8 additions & 4 deletions sdk/src/com/appnexus/opensdk/AdView.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,22 +259,26 @@ public boolean loadAd(String placementID) {
return loadAd();
}

protected void loadAdFromHtml(String html, int width, int height) {
protected void loadAdFromHtml(String html, int width, int height, int buyerMemberId) {
// load an ad directly from html
loadedOffscreen = true;
AdWebView output = new AdWebView(this, null);
RTBHTMLAdResponse response = new RTBHTMLAdResponse(width, height, getMediaType().toString(), null, getAdResponseInfo());
ANAdResponseInfo adResponseInfo = new ANAdResponseInfo();
adResponseInfo.setBuyMemberId(buyerMemberId);
RTBHTMLAdResponse response = new RTBHTMLAdResponse(width, height, getMediaType().toString(), null, adResponseInfo);
response.setAdContent(html);
output.loadAd(response);
display(output);
}


protected void loadAdFromVAST(String VASTXML, int width, int height) {
protected void loadAdFromVAST(String VASTXML, int width, int height, int buyerMemberId) {
// load an ad directly from VASTXML
loadedOffscreen = true;
AdWebView output = new AdWebView(this, null);
RTBVASTAdResponse response = new RTBVASTAdResponse(width, height, AdType.VIDEO.toString(), null, null, getAdResponseInfo());
ANAdResponseInfo adResponseInfo = new ANAdResponseInfo();
adResponseInfo.setBuyMemberId(buyerMemberId);
RTBVASTAdResponse response = new RTBVASTAdResponse(width, height, AdType.VIDEO.toString(), null, null, adResponseInfo);
response.setAdContent(VASTXML);
response.setContentSource(UTConstants.RTB);
response.addToExtras(UTConstants.EXTRAS_KEY_MRAID, true);
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/com/appnexus/opensdk/InitListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
package com.appnexus.opensdk;

public interface InitListener {
void onInitFinished();
void onInitFinished(boolean success);
}
4 changes: 2 additions & 2 deletions sdk/src/com/appnexus/opensdk/SDKSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public void run() {
if (!isAAIDFetched) {
AdvertisingIDUtil.retrieveAndSetAAID(context, new InitListener() {
@Override
public void onInitFinished() {
public void onInitFinished(boolean success) {
isAAIDFetched = true;
SDKSettings.onInitFinished(listener);
}
Expand All @@ -492,7 +492,7 @@ private static void onInitFinished(final InitListener listener) {
TasksManager.getInstance().executeOnMainThread(new Runnable() {
@Override
public void run() {
listener.onInitFinished();
listener.onInitFinished(true);
}
});
}
Expand Down
13 changes: 9 additions & 4 deletions sdk/src/com/appnexus/opensdk/XandrAd.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -63,16 +62,22 @@ public static void init(int memberId, Context context, boolean preCacheContent,
if (!isSdkInitialised) {
SDKSettings.init(context, new InitListener() {
@Override
public void onInitFinished() {
public void onInitFinished(boolean success) {
isSdkInitialised = true;
if (initListener != null && areMemberIdsCached) {
initListener.onInitFinished();
initListener.onInitFinished(success);
}
}
});
}
XandrAd.memberId = memberId;
if (!areMemberIdsCached) {
if (context != null && !SharedNetworkManager.getInstance(context).isConnected(context)) {
if (initListener != null) {
initListener.onInitFinished(false);
return;
}
}
HTTPGet fetchJson = new HTTPGet() {
@Override
protected void onPostExecute(HTTPResponse response) {
Expand All @@ -92,7 +97,7 @@ protected void onPostExecute(HTTPResponse response) {

areMemberIdsCached = true;
if (initListener != null && isSdkInitialised) {
initListener.onInitFinished();
initListener.onInitFinished(true);
}
}

Expand Down
Loading

0 comments on commit 3b59232

Please sign in to comment.