Skip to content

Commit

Permalink
Release 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed Sep 25, 2024
1 parent 360f90a commit 550e059
Show file tree
Hide file tree
Showing 83 changed files with 587 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ android {
targetSdkVersion 34
versionCode 1
versionName "1.0"
multiDexEnabled true
}

buildTypes {
Expand All @@ -26,8 +27,9 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation "androidx.multidex:multidex:2.0.1"
//To integrate PubMatic SDK
implementation 'com.pubmatic.sdk:openwrap:3.+'
implementation 'com.pubmatic.sdk:openwrap:4.+'
// Highly recommended to fetch the Android Advertising Id in OW SDK
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
android:name=".OpenWrapSampleApp"
android:allowBackup="true"
android:icon="@mipmap/icon_app_launcher"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ import java.net.URL
*/
class BannerActivity : AppCompatActivity() {

private val TAG = "BannerActivity"
private val OPENWRAP_AD_UNIT_ID = "OpenWrapBannerAdUnit"

private var banner: POBBannerView ? = null

override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -60,8 +63,8 @@ class BannerActivity : AppCompatActivity() {
// Call init() to set tag information
// For test IDs see - https://help.pubmatic.com/openwrap/docs/test-and-debug-your-integration#test-profileplacements
banner = findViewById(R.id.banner)
banner?.init(PUB_ID,
PROFILE_ID, OPENWRAP_AD_UNIT_ID, POBAdSize.BANNER_SIZE_320x50)
banner?.init(Constants.PUB_ID,
Constants.PROFILE_ID, OPENWRAP_AD_UNIT_ID, POBAdSize.BANNER_SIZE_320x50)

//optional listener to listen banner events
banner?.setListener(POBBannerViewListener())
Expand Down Expand Up @@ -137,10 +140,4 @@ class BannerActivity : AppCompatActivity() {
banner?.destroy()
}

companion object {
private const val TAG = "BannerActivity"
private const val OPENWRAP_AD_UNIT_ID = "OpenWrapBannerAdUnit"
private const val PUB_ID = "156276"
private const val PROFILE_ID = 1165
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* PubMatic Inc. ("PubMatic") CONFIDENTIAL
* Unpublished Copyright (c) 2006-2024 PubMatic, All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of PubMatic. The intellectual and technical concepts contained
* herein are proprietary to PubMatic and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained
* from PubMatic. Access to the source code contained herein is hereby forbidden to anyone except current PubMatic employees, managers or contractors who have executed
* Confidentiality and Non-disclosure agreements explicitly covering such access or to such other persons whom are directly authorized by PubMatic to access the source code and are subject to confidentiality and nondisclosure obligations with respect to the source code.
*
* The copyright notice above does not evidence any actual or intended publication or disclosure of this source code, which includes
* information that is confidential and/or proprietary, and is a trade secret, of PubMatic. ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE,
* OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT THE EXPRESS WRITTEN CONSENT OF PUBMATIC IS STRICTLY PROHIBITED, AND IN VIOLATION OF APPLICABLE
* LAWS AND INTERNATIONAL TREATIES. THE RECEIPT OR POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY ANY RIGHTS
* TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART.
*/

package com.pubmatic.openwrap.kotlinsampleapp

/**
* Constants used in other activities
*/
object Constants {
const val PUB_ID = "156276"
const val PROFILE_ID = 1165
const val PROFILE_ID_FOR_VIDEO = 1757
const val OWSDK_INITIALIZATION_SUCCESSFUL = "OpenWrap SDK initialization successful"
const val OWSDK_INITIALIZATION_FAILED = "OpenWrap SDK initialization failed with error : "
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ import java.net.URL
*/
class InterstitialActivity : AppCompatActivity() {

private val TAG = "InterstitialActivity"
private val OPENWRAP_AD_UNIT_ID = "OpenWrapInterstitialAdUnit"

private var interstitial : POBInterstitial? = null
private var loadAd: Button? = null
private var showAd: Button? = null
Expand All @@ -60,7 +63,7 @@ class InterstitialActivity : AppCompatActivity() {
OpenWrapSDK.setApplicationInfo(appInfo)

// Initialise interstitial ad
interstitial = POBInterstitial(this, PUB_ID, PROFILE_ID, OPENWRAP_AD_UNIT_ID)
interstitial = POBInterstitial(this, Constants.PUB_ID, Constants.PROFILE_ID, OPENWRAP_AD_UNIT_ID)

// Set optional listener
interstitial?.setListener(POBInterstitialListener())
Expand Down Expand Up @@ -171,10 +174,4 @@ class InterstitialActivity : AppCompatActivity() {
interstitial?.destroy()
}

companion object {
private const val TAG = "InterstitialActivity"
private const val OPENWRAP_AD_UNIT_ID = "OpenWrapInterstitialAdUnit"
private const val PUB_ID = "156276"
private const val PROFILE_ID = 1165
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class MainActivity : AppCompatActivity() {
private var recycler: RecyclerView? = null
private var list: ArrayList<AdType>? = null


companion object {

private fun hasPermissions(context: Context, permissions: Array<String>): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ import java.net.URL
*/
class NativeAdActivity : AppCompatActivity() {

private val TAG = "NativeAdActivity"
private val OPENWRAP_AD_UNIT_ID = "OpenWrapNativeAdUnit"

private lateinit var nativeAdLoader: POBNativeAdLoader

private var nativeAd: POBNativeAd? = null
Expand Down Expand Up @@ -93,7 +96,7 @@ class NativeAdActivity : AppCompatActivity() {

// Create native ad loader to make request to openWrap
nativeAdLoader = POBNativeAdLoader(
this, PUB_ID, PROFILE_ID,
this, Constants.PUB_ID, Constants.PROFILE_ID,
OPENWRAP_AD_UNIT_ID, POBNativeTemplateType.SMALL
)

Expand Down Expand Up @@ -125,12 +128,6 @@ class NativeAdActivity : AppCompatActivity() {
nativeAd?.destroy()
}

companion object {
private const val TAG = "NativeAdActivity"
private const val PUB_ID = "156276"
private const val PROFILE_ID = 1165
private const val OPENWRAP_AD_UNIT_ID = "OpenWrapNativeAdUnit"
}

/**
* Listener to get callback for ad received and ad failed.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* PubMatic Inc. ("PubMatic") CONFIDENTIAL
* Unpublished Copyright (c) 2006-2024 PubMatic, All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of PubMatic. The intellectual and technical concepts contained
* herein are proprietary to PubMatic and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained
* from PubMatic. Access to the source code contained herein is hereby forbidden to anyone except current PubMatic employees, managers or contractors who have executed
* Confidentiality and Non-disclosure agreements explicitly covering such access or to such other persons whom are directly authorized by PubMatic to access the source code and are subject to confidentiality and nondisclosure obligations with respect to the source code.
*
* The copyright notice above does not evidence any actual or intended publication or disclosure of this source code, which includes
* information that is confidential and/or proprietary, and is a trade secret, of PubMatic. ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE,
* OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT THE EXPRESS WRITTEN CONSENT OF PUBMATIC IS STRICTLY PROHIBITED, AND IN VIOLATION OF APPLICABLE
* LAWS AND INTERNATIONAL TREATIES. THE RECEIPT OR POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY ANY RIGHTS
* TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART.
*/

package com.pubmatic.openwrap.kotlinsampleapp

import android.util.Log
import androidx.multidex.MultiDexApplication
import com.pubmatic.sdk.common.OpenWrapSDK
import com.pubmatic.sdk.common.OpenWrapSDKConfig
import com.pubmatic.sdk.common.OpenWrapSDKInitializer
import com.pubmatic.sdk.common.POBError

/**
* OpenWrapSampleApp Application class to Initialize SDK
*/
class OpenWrapSampleApp : MultiDexApplication() {

private val TAG = "OpenWrap"
override fun onCreate() {
super.onCreate()

// Call the initialize method to warm up the OpenWrap SDK.
OpenWrapSDK.initialize(
applicationContext,
OpenWrapSDKConfig.Builder(Constants.PUB_ID,listOf(Constants.PROFILE_ID)).build(),
object : OpenWrapSDKInitializer.Listener {
override fun onSuccess() {
Log.i(TAG, Constants.OWSDK_INITIALIZATION_SUCCESSFUL)
}

override fun onFailure(error: POBError) {
Log.e(TAG, Constants.OWSDK_INITIALIZATION_FAILED + error.toString())
}
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ import java.net.URL
*/
class RewardedActivity : AppCompatActivity() {

private val TAG = "RewardedActivity"
private val OPENWRAP_AD_UNIT_ID = "OpenWrapRewardedAdUnit"

private var rewardedAd : POBRewardedAd? = null
private var loadAd: Button? = null
private var showAd: Button? = null
Expand All @@ -61,7 +64,7 @@ class RewardedActivity : AppCompatActivity() {
OpenWrapSDK.setApplicationInfo(appInfo)

// Initialise Rewarded ad
rewardedAd = POBRewardedAd.getRewardedAd(this, PUB_ID, PROFILE_ID,
rewardedAd = POBRewardedAd.getRewardedAd(this, Constants.PUB_ID, Constants.PROFILE_ID_FOR_VIDEO,
OPENWRAP_AD_UNIT_ID
)

Expand Down Expand Up @@ -182,10 +185,4 @@ class RewardedActivity : AppCompatActivity() {
rewardedAd?.destroy()
}

companion object {
private const val TAG = "RewardedActivity"
private const val OPENWRAP_AD_UNIT_ID = "OpenWrapRewardedAdUnit"
private const val PUB_ID = "156276"
private const val PROFILE_ID = 1757
}
}
4 changes: 2 additions & 2 deletions OpenWrap/Advance/In-House-Mediation/KotlinSample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.5.10'

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.2.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
4 changes: 3 additions & 1 deletion OpenWrap/Advance/ListApp/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ android {
targetSdkVersion 34
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
Expand All @@ -29,7 +30,8 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
implementation 'com.pubmatic.sdk:openwrap:3.+'
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.pubmatic.sdk:openwrap:4.+'
// Highly recommended to fetch the Android Advertising Id in OW SDK
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
}
1 change: 1 addition & 0 deletions OpenWrap/Advance/ListApp/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
android:name=".OpenWrapSampleApp"
android:allowBackup="true"
android:icon="@mipmap/icon_app_launcher"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,14 @@ object Constants {
* Total number of items in the feed list including ad and placeholder
*/
val NUMBER_OF_ITEMS = 20

const val PUB_ID = "156276"

const val PROFILE_ID = 1165

const val PROFILE_ID_FOR_VIDEO = 1757

const val OWSDK_INITIALIZATION_SUCCESSFUL = "OpenWrap SDK initialization successful"

const val OWSDK_INITIALIZATION_FAILED = "OpenWrap SDK initialization failed with error : "
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class MainActivity : AppCompatActivity() {
private var recycler: RecyclerView? = null
private var list: ArrayList<AD_TYPE>? = null


// To check app already has the requested permission.
private fun hasPermissions(context: Context, permissions: Array<String>): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* PubMatic Inc. ("PubMatic") CONFIDENTIAL
* Unpublished Copyright (c) 2006-2024 PubMatic, All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of PubMatic. The intellectual and technical concepts contained
* herein are proprietary to PubMatic and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained
* from PubMatic. Access to the source code contained herein is hereby forbidden to anyone except current PubMatic employees, managers or contractors who have executed
* Confidentiality and Non-disclosure agreements explicitly covering such access or to such other persons whom are directly authorized by PubMatic to access the source code and are subject to confidentiality and nondisclosure obligations with respect to the source code.
*
* The copyright notice above does not evidence any actual or intended publication or disclosure of this source code, which includes
* information that is confidential and/or proprietary, and is a trade secret, of PubMatic. ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE,
* OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT THE EXPRESS WRITTEN CONSENT OF PUBMATIC IS STRICTLY PROHIBITED, AND IN VIOLATION OF APPLICABLE
* LAWS AND INTERNATIONAL TREATIES. THE RECEIPT OR POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY ANY RIGHTS
* TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART.
*/

package com.pubmatic.openwrap.listapp

import android.util.Log
import androidx.multidex.MultiDexApplication
import com.pubmatic.sdk.common.OpenWrapSDK
import com.pubmatic.sdk.common.OpenWrapSDKConfig
import com.pubmatic.sdk.common.OpenWrapSDKInitializer
import com.pubmatic.sdk.common.POBError

/**
* OpenWrapSampleApp Application class to Initialize SDK
*/
class OpenWrapSampleApp : MultiDexApplication() {

private val TAG = "OpenWrap"
override fun onCreate() {
super.onCreate()
// Call the initialize method to warm up the OpenWrap SDK.
OpenWrapSDK.initialize(
applicationContext,
OpenWrapSDKConfig.Builder(Constants.PUB_ID,listOf(Constants.PROFILE_ID)).build(),
object : OpenWrapSDKInitializer.Listener {
override fun onSuccess() {
Log.i(TAG, Constants.OWSDK_INITIALIZATION_SUCCESSFUL)
}

override fun onFailure(error: POBError) {
Log.e(TAG, Constants.OWSDK_INITIALIZATION_FAILED + error.toString())
}
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.pubmatic.openwrap.listapp.Constants
import com.pubmatic.openwrap.listapp.R
import com.pubmatic.sdk.common.OpenWrapSDK
import com.pubmatic.sdk.common.POBAdSize
import com.pubmatic.sdk.openwrap.banner.POBBannerView

Expand All @@ -35,8 +34,6 @@ class BannerListActivity : AppCompatActivity() {

// Banner Ad Units
private val OPENWRAP_AD_UNIT_ID = "OpenWrapBannerAdUnit"
private val PUB_ID = "156276"
private val PROFILE_ID = 1757
// Feed list
private var feedList = ArrayList<BannerFeedItem>()

Expand Down Expand Up @@ -86,7 +83,7 @@ class BannerListActivity : AppCompatActivity() {
var isFirstBannerLoaded = false
for (i in 1..Constants.NUMBER_OF_ITEMS) {
if (i % (Constants.AD_INTERVAL + 1) == 0) {
val banner = POBBannerView(this, PUB_ID, PROFILE_ID, OPENWRAP_AD_UNIT_ID, POBAdSize.BANNER_SIZE_300x250)
val banner = POBBannerView(this, Constants.PUB_ID, Constants.PROFILE_ID_FOR_VIDEO, OPENWRAP_AD_UNIT_ID, POBAdSize.BANNER_SIZE_300x250)
val feedItem = BannerFeedItem("Banner ${i / (Constants.AD_INTERVAL + 1)}", BannerFeedItem.FeedType.BANNER, banner, false)
feedList.add(feedItem)
if (!isFirstBannerLoaded) {
Expand Down
Loading

0 comments on commit 550e059

Please sign in to comment.