Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
7 changes: 4 additions & 3 deletions SampleApp/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
compileSdkVersion 33

defaultConfig {
applicationId "com.pubmatic.openwrap.ottsampleapplication"
minSdkVersion 16
targetSdkVersion 29
minSdkVersion 19
targetSdkVersion 33
versionCode 1
versionName "1.0"
multiDexEnabled true
Expand All @@ -24,6 +24,7 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'com.pubmatic.openwrap.ottsampleapplication'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
import com.pubmatic.openwrap.POWUtil;
import com.pubmatic.openwrap.models.POWApplicationInfo;

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

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import java.net.URLEncoder;

public class MainActivity extends AppCompatActivity {

private static final String TAG = "MainActivity";
Expand Down Expand Up @@ -67,6 +69,7 @@ protected void onCreate(Bundle savedInstanceState) {
// Update the GAM url by replacing required values like Ad unit id, ad size
final String gamAdsUrl = String.format(Constants.GAM_AD_URL, Constants.AD_UNIT_ID,
AD_SIZE.getFormattedAdSize());
//String updatedGamAdsUrl = Constants.GAM_AD_URL;
Comment thread
randeepsiddhu marked this conversation as resolved.
Outdated

// Initialise OpenWrap Ads Loader
owAdsLoader = new POWAdsLoader(this);
Expand All @@ -75,6 +78,10 @@ protected void onCreate(Bundle savedInstanceState) {
POWAdRequest adRequest = new POWAdRequest(Constants.PUB_ID, Constants.PROFILE_ID,
Constants.AD_UNIT_ID, AD_SIZE);

adRequest.setTestEnable(true);

adRequest.setUserAgent(Util.getUserAgent(this, getString(R.string.app_name)));

// Set Application details
POWConfiguration configuration = POWConfiguration.getInstance();
POWApplicationInfo applicationInfo = new POWApplicationInfo(this);
Expand All @@ -85,10 +92,12 @@ protected void onCreate(Bundle savedInstanceState) {
owAdsLoader.setAdsLoaderListener(new POWAdLoading.AdsLoaderListener() {
@Override
public void onAdReceived(@NonNull POWAdResponse response) {
JSONObject targetingJson = response.getTargeting();
String updatedGamAdsUrl = gamAdsUrl;
JSONArray targetingJson = response.getTargeting();
String cust_params = "dp=0&tool=video&artid=42733721&pos=preroll&";
Comment thread
randeepsiddhu marked this conversation as resolved.
Outdated
String updatedGamAdsUrl = gamAdsUrl + "&cust_params=" + URLEncoder.encode(cust_params);
if (targetingJson != null) {
updatedGamAdsUrl = updatedGamAdsUrl + "&cust_params=" + POWUtil.generateEncodedQueryParams(targetingJson);
Log.d(TAG, "targeting json :" + targetingJson);
updatedGamAdsUrl = updatedGamAdsUrl + POWUtil.generateEncodedQueryParams(targetingJson);
}
Log.d(TAG, "DFP URL :" + updatedGamAdsUrl);
initializeAdsLoader(updatedGamAdsUrl);
Expand Down
2 changes: 1 addition & 1 deletion SampleApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
classpath 'com.android.tools.build:gradle:8.1.4'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
5 changes: 4 additions & 1 deletion SampleApp/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ org.gradle.jvmargs=-Xmx2048m
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
enableUnitTestBinaryResources = true
enableUnitTestBinaryResources = true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
53 changes: 33 additions & 20 deletions SampleApp/gradlew
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 24 additions & 19 deletions SampleApp/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions SampleApp/openwrap/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 29
compileSdkVersion 33
useLibrary 'org.apache.http.legacy'

defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
Comment thread
randeepsiddhu marked this conversation as resolved.
versionName "1.0"
minSdkVersion 19
targetSdkVersion 33

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -24,6 +22,7 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'com.pubmatic.openwrap'
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions SampleApp/openwrap/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pubmatic.openwrap">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<!-- Required below meta-data for fetching the advertising Id from Google Play service -->
<meta-data
Expand Down
Loading