com.chartboost.mediation.unity.adapter.amazon-publisher-services 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/Android~/src/APSBridge.kt +37 -0
  2. package/Android~/src/APSPreBidCompletion.kt +6 -0
  3. package/Android~/src/APSPreBidConsumer.kt +6 -0
  4. package/CHANGELOG.md +41 -0
  5. package/CHANGELOG.md.meta +7 -0
  6. package/Chartboost.CSharp.Mediation.Unity.Adapter.AmazonPublisherServices.nuspec +23 -0
  7. package/Chartboost.CSharp.Mediation.Unity.Adapter.AmazonPublisherServices.nuspec.meta +7 -0
  8. package/Editor/AmazonPublisherServicesAdapterDependencies.xml +24 -0
  9. package/Editor/AmazonPublisherServicesAdapterDependencies.xml.meta +7 -0
  10. package/Editor.meta +8 -0
  11. package/LICENSE.md +9 -0
  12. package/LICENSE.md.meta +7 -0
  13. package/README.md +212 -0
  14. package/README.md.meta +7 -0
  15. package/Runtime/AmazonPublisherServices/AmazonPublisherServicesAdapter.cs +39 -0
  16. package/Runtime/AmazonPublisherServices/AmazonPublisherServicesAdapter.cs.meta +11 -0
  17. package/Runtime/AmazonPublisherServices/AmazonPublisherServicesAdapterPreBidAdInfo.cs +25 -0
  18. package/Runtime/AmazonPublisherServices/AmazonPublisherServicesAdapterPreBidAdInfo.cs.meta +3 -0
  19. package/Runtime/AmazonPublisherServices/AmazonPublisherServicesAdapterPreBidRequest.cs +49 -0
  20. package/Runtime/AmazonPublisherServices/AmazonPublisherServicesAdapterPreBidRequest.cs.meta +11 -0
  21. package/Runtime/AmazonPublisherServices/AmazonSettings.cs +38 -0
  22. package/Runtime/AmazonPublisherServices/AmazonSettings.cs.meta +11 -0
  23. package/Runtime/AmazonPublisherServices/AssemblyInfo.cs +16 -0
  24. package/Runtime/AmazonPublisherServices/AssemblyInfo.cs.meta +3 -0
  25. package/Runtime/AmazonPublisherServices/Chartboost.Mediation.AmazonPublisherServices.asmdef +21 -0
  26. package/Runtime/AmazonPublisherServices/Chartboost.Mediation.AmazonPublisherServices.asmdef.meta +7 -0
  27. package/Runtime/AmazonPublisherServices/Common/IAmazonPublisherServicesAdapter.cs +29 -0
  28. package/Runtime/AmazonPublisherServices/Common/IAmazonPublisherServicesAdapter.cs.meta +3 -0
  29. package/Runtime/AmazonPublisherServices/Common/PreBiddingListener.cs +9 -0
  30. package/Runtime/AmazonPublisherServices/Common/PreBiddingListener.cs.meta +3 -0
  31. package/Runtime/AmazonPublisherServices/Common.meta +8 -0
  32. package/Runtime/AmazonPublisherServices/Default/AmazonPublisherServicesDefault.cs +43 -0
  33. package/Runtime/AmazonPublisherServices/Default/AmazonPublisherServicesDefault.cs.meta +3 -0
  34. package/Runtime/AmazonPublisherServices/Default.meta +8 -0
  35. package/Runtime/AmazonPublisherServices.meta +8 -0
  36. package/Runtime/Android/AmazonPublisherServicesAdapter.cs +164 -0
  37. package/Runtime/Android/AmazonPublisherServicesAdapter.cs.meta +11 -0
  38. package/Runtime/Android/AssemblyInfo.cs +3 -0
  39. package/Runtime/Android/AssemblyInfo.cs.meta +3 -0
  40. package/Runtime/Android/Chartboost.Mediation.AmazonPublisherServices.Android.asmdef +26 -0
  41. package/Runtime/Android/Chartboost.Mediation.AmazonPublisherServices.Android.asmdef.meta +7 -0
  42. package/Runtime/Android/Plugins/Android/AmazonPublisherServicesAdapter.jar +0 -0
  43. package/Runtime/Android/Plugins/Android/AmazonPublisherServicesAdapter.jar.meta +32 -0
  44. package/Runtime/Android/Plugins/Android.meta +8 -0
  45. package/Runtime/Android/Plugins.meta +8 -0
  46. package/Runtime/Android.meta +8 -0
  47. package/Runtime/IOS/AmazonPublisherServicesAdapter.cs +105 -0
  48. package/Runtime/IOS/AmazonPublisherServicesAdapter.cs.meta +11 -0
  49. package/Runtime/IOS/AssemblyInfo.cs +3 -0
  50. package/Runtime/IOS/AssemblyInfo.cs.meta +11 -0
  51. package/Runtime/IOS/Chartboost.Mediation.AmazonPublisherServices.IOS.asmdef +25 -0
  52. package/Runtime/IOS/Chartboost.Mediation.AmazonPublisherServices.IOS.asmdef.meta +7 -0
  53. package/Runtime/IOS/Plugins/iOS/CBMAPSUnityBridge.mm +51 -0
  54. package/Runtime/IOS/Plugins/iOS/CBMAPSUnityBridge.mm.meta +37 -0
  55. package/Runtime/IOS/Plugins/iOS/CBMAPSUnityPreBiddingObserver.h +17 -0
  56. package/Runtime/IOS/Plugins/iOS/CBMAPSUnityPreBiddingObserver.h.meta +27 -0
  57. package/Runtime/IOS/Plugins/iOS/CBMAPSUnityPreBiddingObserver.mm +51 -0
  58. package/Runtime/IOS/Plugins/iOS/CBMAPSUnityPreBiddingObserver.mm.meta +37 -0
  59. package/Runtime/IOS/Plugins/iOS.meta +8 -0
  60. package/Runtime/IOS/Plugins.meta +8 -0
  61. package/Runtime/IOS.meta +8 -0
  62. package/Runtime.meta +8 -0
  63. package/Tests/Editor/Chartboost.Mediation.AmazonPublisherServices.Tests.Editor.asmdef +26 -0
  64. package/Tests/Editor/Chartboost.Mediation.AmazonPublisherServices.Tests.Editor.asmdef.meta +7 -0
  65. package/Tests/Editor/VersionValidator.cs +21 -0
  66. package/Tests/Editor/VersionValidator.cs.meta +3 -0
  67. package/Tests/Editor.meta +8 -0
  68. package/Tests/Runtime/AmazonPublisherServicesAdapterTests.cs +38 -0
  69. package/Tests/Runtime/AmazonPublisherServicesAdapterTests.cs.meta +11 -0
  70. package/Tests/Runtime/Chartboost.Mediation.AmazonPublisherServices.Tests.Runtime.asmdef +29 -0
  71. package/Tests/Runtime/Chartboost.Mediation.AmazonPublisherServices.Tests.Runtime.asmdef.meta +7 -0
  72. package/Tests/Runtime.meta +8 -0
  73. package/Tests.meta +8 -0
  74. package/package.json +31 -0
  75. package/package.json.meta +7 -0
  76. package/rsync.sh +17 -0
  77. package/rsync.sh.meta +3 -0
@@ -0,0 +1,37 @@
1
+ package com.chartboost.mediation.unity.adapter.aps
2
+
3
+ import android.content.Context
4
+ import com.chartboost.mediation.amazonpublisherservicesadapter.AmazonPublisherServicesAdapter
5
+ import kotlin.coroutines.resume
6
+ import kotlin.coroutines.suspendCoroutine
7
+
8
+ class APSBridge {
9
+
10
+ companion object {
11
+
12
+ private var preBiddingListener: AmazonPublisherServicesAdapter.PreBiddingListener? = null
13
+
14
+ @JvmStatic
15
+ fun setupPreBiddingListener(consumer: APSPreBidConsumer){
16
+ preBiddingListener = object : AmazonPublisherServicesAdapter.PreBiddingListener {
17
+ override suspend fun onPreBid(context: Context, request: AmazonPublisherServicesAdapter.AmazonPublisherServicesAdapterPreBidRequest): Result<AmazonPublisherServicesAdapter.AmazonPublisherServicesAdapterPreBidAdInfo> {
18
+ return suspendCoroutine { continuation ->
19
+ consumer.onPreBid(request, object: APSPreBidCompletion {
20
+ override fun completion(preBidAdInfo: AmazonPublisherServicesAdapter.AmazonPublisherServicesAdapterPreBidAdInfo) {
21
+ continuation.resume(Result.success(preBidAdInfo))
22
+ }
23
+ })
24
+ }
25
+ }
26
+ }
27
+ AmazonPublisherServicesAdapter.preBiddingListener = preBiddingListener;
28
+ }
29
+
30
+ @JvmStatic
31
+ fun removePreBiddingListener()
32
+ {
33
+ preBiddingListener = null;
34
+ AmazonPublisherServicesAdapter.preBiddingListener = null;
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,6 @@
1
+ package com.chartboost.mediation.unity.adapter.aps
2
+
3
+ import com.chartboost.mediation.amazonpublisherservicesadapter.AmazonPublisherServicesAdapter
4
+ interface APSPreBidCompletion {
5
+ fun completion(preBidAdInfo: AmazonPublisherServicesAdapter.AmazonPublisherServicesAdapterPreBidAdInfo)
6
+ }
@@ -0,0 +1,6 @@
1
+ package com.chartboost.mediation.unity.adapter.aps
2
+
3
+ import com.chartboost.mediation.amazonpublisherservicesadapter.AmazonPublisherServicesAdapter
4
+ interface APSPreBidConsumer {
5
+ fun onPreBid(request: AmazonPublisherServicesAdapter.AmazonPublisherServicesAdapterPreBidRequest, completion: APSPreBidCompletion)
6
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file using the standards as defined at [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0).
3
+
4
+ ### Version 5.0.0 *(2024-08-08)*
5
+
6
+ #Added
7
+ - Support for the following 'Amazon Publisher Services' dependencies. Notice adapter dependencies are optimistic and any patches and hot-fixes will be automatically picked up.:
8
+ * Android: `com.chartboost:chartboost-mediation-adapter-amazon-publisher-services:5.9.10.+`
9
+ * iOS: `ChartboostMediationAdapterAmazonPublisherServices ~> ~> 5.4.9.0`
10
+
11
+ - The following properties have been added in `AmazonPublisherServicesAdapter.cs`
12
+ * `string AdapterUnityVersion`
13
+ * `string AdapterNativeVersion`
14
+ * `string PartnerSDKVersion`
15
+ * `string PartnerIdentifier`
16
+ * `string PartnerDisplayName`
17
+ * `bool TestMode`
18
+ * `bool VerboseLogging`
19
+
20
+ ### Version 4.0.1 *(2024-03-27)*
21
+ Bug Fixes:
22
+
23
+ - Added `<androidPackage spec="com.iabtcf:iabtcf-decoder:2.0.10"/>` to `AmazonPublisherServicesAdapterDependencies.xml`
24
+
25
+ ### Version 4.0.0 *(2024-03-21)*
26
+ First version of the Chartboost Mediation Unity SDK - Amazon Publisher Services Adapter.
27
+
28
+ This package requires the APS Unity Plugin to be integrated in the project in order to be used.
29
+
30
+ New:
31
+
32
+ - Added `AmazonPublisherServicesAdapter` class.
33
+ - Added `TestMode` mode to setup APS test mode.
34
+ - Added `VerboseLogging` to modify adapter logging leve.
35
+ - Added `PreBiddingListener` class and property to handle publisher based pre-bidding.
36
+ - Added `AmazonSettings` struct to pass required data to the Chartboost Mediation SDK.
37
+
38
+ Compatible with the following native Android and iOS SDK Versions:
39
+
40
+ * Android: Amazon Publisher Services `com.amazon.android:aps-sdk:9.9.+`
41
+ * iOS: `AmazonPublisherServicesSDK ~> 4.8.0`
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: d446c8e6a900b4ec38a634fb63051798
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <package>
3
+ <metadata>
4
+ <id>Chartboost.CSharp.Mediation.Unity.Adapter.AmazonPublisherServices</id>
5
+ <version>5.0.0</version>
6
+ <title>Chartboost Mediation Adapter - Amazon Publisher Services Adapter</title>
7
+ <description>The Chartboost Mediation Unity SDK Ad Adapter for Amazon Publisher Services.</description>
8
+ <authors>Chartboost</authors>
9
+ <owners>Chartboost</owners>
10
+ <license type="file">LICENSE.md</license>
11
+ <readme>README.md</readme>
12
+ <projectUrl>https://www.chartboost.com/mediate</projectUrl>
13
+ <copyright>Copyright 2024</copyright>
14
+ <tags>Chartboost, Ads, Mediation, Unity, Adapter, AmazonPublisherServices, cs</tags>
15
+ <repository type="git" url="https://github.com/ChartBoost/chartboost-mediation-unity-adapter-amazon-publisher-services"/>
16
+ <dependencies>
17
+ <dependency id="Chartboost.CSharp.Mediation.Unity" version="5.0.0" />
18
+ <dependency id="Chartboost.CSharp.Threading.Unity" version="1.0.1" />
19
+ <dependency id="Chartboost.CSharp.Utilities.Unity" version="1.0.1" />
20
+ <dependency id="Chartboost.CSharp.Logging.Unity" version="1.0.0" />
21
+ </dependencies>
22
+ </metadata>
23
+ </package>
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 172a69d61d3184c9fbce89217037daac
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <dependencies>
3
+ <androidPackages>
4
+ <!-- Android Adapter -->
5
+ <androidPackage spec="com.chartboost:chartboost-mediation-adapter-amazon-publisher-services:5.9.10.+"/>
6
+
7
+ <!-- Partner Android SDK Dependencies-->
8
+ <androidPackage spec="com.iabtcf:iabtcf-decoder:2.0.10"/>
9
+
10
+ <repositories>
11
+ <repository>https://aws.oss.sonatype.org/content/repositories/releases/</repository>
12
+ </repositories>
13
+ </androidPackages>
14
+ <iosPods>
15
+ <!-- iOS Adapter -->
16
+ <iosPod name="ChartboostMediationAdapterAmazonPublisherServices" version="~> 5.4.9.0"/>
17
+
18
+ <!-- Partner iOS SDK-->
19
+ <iosPod name="AmazonPublisherServicesSDK" version="~> 4.9.0" addToAllTargets="true"/>
20
+
21
+ <!-- Amazon Plugin for iOS-->
22
+ <iosPod name="Amazon-SDK-Plugin" minTargetSdk="12.5" path="Assets/Amazon/Plugins/iOS"/>
23
+ </iosPods>
24
+ </dependencies>
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: d5da2b4efb1934e8fbe963b6f48019d5
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/Editor.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 6ee1a2bd5851a45778352b559f916b3a
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright 2024 Chartboost Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: e653d9c0d7d6d41909436337c255fc84
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/README.md ADDED
@@ -0,0 +1,212 @@
1
+ # Chartboost Mediation Unity SDK - Amazon Publisher Services Adapter
2
+
3
+ Provides a list of externally configurable properties pertaining to the partner SDK that can be retrieved and set by publishers.
4
+
5
+ Dependencies for the adapter are now embedded in the package, and can be found at `com.chartboost.mediation.unity.adapter.amazon-publisher-services/Editor/AmazonPublisherServicesAdapterDependencies.xml`.
6
+
7
+ Ad adapter for Amazon Publisher Services, to be utilized along the APS Unity Plugin.
8
+
9
+ # Installation
10
+ This package is meant to be integrating when using Amazon Publisher Services as an ad adapter.
11
+
12
+ ### Using the public [npm registry](https://www.npmjs.com/search?q=com.chartboost.mediation.unity.adapter.amazon-publisher-services)
13
+
14
+ In order to add the Chartboost Mediation Unity SDK - Amazon Publisher Services Adapter to your project using the npm package, add the following to your Unity Project's ***manifest.json*** file. The scoped registry section is required in order to fetch packages from the NpmJS registry.
15
+
16
+ ```json
17
+ "dependencies": {
18
+ "com.chartboost.mediation.unity.adapter.amazon-publisher-services": "5.0.0",
19
+ ...
20
+ },
21
+ "scopedRegistries": [
22
+ {
23
+ "name": "NpmJS",
24
+ "url": "https://registry.npmjs.org",
25
+ "scopes": [
26
+ "com.chartboost"
27
+ ]
28
+ }
29
+ ]
30
+ ```
31
+
32
+ ### Using the public [NuGet package](https://www.nuget.org/packages/Chartboost.CSharp.Mediation.Unity.Adapter.AmazonPublisherServices)
33
+
34
+ To add the Chartboost Mediation Unity SDK - Amazon Publisher Services Adapter to your project using the NuGet package, you will first need to add the [NugetForUnity](https://github.com/GlitchEnzo/NuGetForUnity) package into your Unity Project.
35
+
36
+ This can be done by adding the following to your Unity Project's ***manifest.json***
37
+
38
+ ```json
39
+ "dependencies": {
40
+ "com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
41
+ ...
42
+ },
43
+ ```
44
+
45
+ Once <code>NugetForUnity</code> is installed, search for `Chartboost.CSharp.Mediation.Unity.Adapter.AmazonPublisherServices` in the search bar of Nuget Explorer window(Nuget -> Manage Nuget Packages).
46
+ You should be able to see the `Chartboost.CSharp.Mediation.Unity.Adapter.AmazonPublisherServices` package. Choose the appropriate version and install.
47
+
48
+ # Demo App
49
+ A demo application is available in the following [repository](https://github.com/ChartBoost/chartboost-mediation-unity-adapter-amazon-publisher-services-demo).
50
+
51
+ # AndroidManifest.xml Permissions & Activities
52
+
53
+ The following permissions must be present in your manifest file:
54
+
55
+ ```xml
56
+ <uses-permission android:name="android.permission.INTERNET" />
57
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
58
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
59
+ ```
60
+
61
+ If you wish to pass geo location information, please include the following permissions in your manifest file:
62
+
63
+ ```xml
64
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
65
+ ```
66
+
67
+ Add the following under the <application> section of your manifest file:
68
+
69
+ ```xml
70
+ <activity android:name="com.amazon.device.ads.DTBInterstitialActivity"/>
71
+ <activity android:name="com.amazon.device.ads.DTBAdActivity"/>
72
+ ```
73
+
74
+ # Dependencies
75
+
76
+ > **Note** \
77
+ > We recommend to delete `Assets/Amazon/Scripts/Editor/AmazonDependencies.xml` and use the `AmazonPublisherServicesAdapterDependencies.xml` file included in the APS Adapter.
78
+
79
+ ## Using AmazonDependencies.xml and Adding AmazonPublisherServicesSDK to All Targets
80
+
81
+ In some scenarios your application might fail to load the `AmazonPublisherServicesSDK`, this is due to the default dependency included in the APS Unity plugin not adding the `AmazonPublisherServicesSDK` `addToAllTargets` flag.
82
+
83
+ To resolve, open, `Assets/Amazon/Scripts/Editor/AmazonDependencies.xml`
84
+
85
+ And change:
86
+
87
+ ```xml
88
+ <iosPod name="AmazonPublisherServicesSDK" version="~> X.Y.Z"/>
89
+ ```
90
+
91
+ to
92
+
93
+ ```xml
94
+ <iosPod name="AmazonPublisherServicesSDK" version="~> X.Y.Z" addToAllTargets="true"/>
95
+ ```
96
+
97
+ # Usage
98
+
99
+ ## IPartnerAdapterConfiguration Properties
100
+
101
+ ```csharp
102
+
103
+ // AdapterUnityVersion - The partner adapter Unity version, e.g: 5.0.0
104
+ Debug.Log($"Adapter Unity Version: {AmazonPublisherServicesAdapter.AdapterUnityVersion}");
105
+
106
+ // AdapterNativeVersion - The partner adapter version, e.g: 5.9.9.5.0
107
+ Debug.Log($"Adapter Native Version: {AmazonPublisherServicesAdapter.AdapterNativeVersion}");
108
+
109
+ // PartnerSDKVersion - The partner SDK version, e.g: aps-android-9.9.5
110
+ Debug.Log($"Partner SDK Version: {AmazonPublisherServicesAdapter.PartnerSDKVersion}");
111
+
112
+ // PartnerIdentifier - The partner ID for internal uses, e.g: amazon_aps
113
+ Debug.Log($"Partner Identifier: {AmazonPublisherServicesAdapter.PartnerIdentifier}");
114
+
115
+ // PartnerDisplayName - The partner name for external uses, e.g: Amazon Publisher Services
116
+ Debug.Log($"Partner Display Name: {AmazonPublisherServicesAdapter.PartnerDisplayName}");
117
+ ```
118
+ ## Test Mode
119
+ To enable test mode for the Amazon Publisher Services adapter, the following property has been made available:
120
+
121
+ ```csharp
122
+ AmazonPublisherServicesAdapter.TestMode = true;
123
+ ```
124
+
125
+ ## Verbose Logging
126
+ To enable verbose logging for the Amazon Publisher Services adapter, the following property has been made available:
127
+
128
+ ```csharp
129
+ AmazonPublisherServicesAdapter.VerboseLogging = true;
130
+ ```
131
+
132
+ ## Creating a Pre-Bidding Listener
133
+
134
+ Chartboost is not permitted to wrap the Amazon APS initialization or bid request methods directly. The adapter handles APS initialization and prebidding only when the managed prebidding flag is enabled. For more information please contact the Amazon APS support team at https://aps.amazon.com/aps/contact-us/.
135
+
136
+ As such, developers are meant to follow the guidelines in the [APS Unity Documentation](https://ams.amazon.com/webpublisher/uam/docs/aps-mobile/unity).
137
+
138
+ In order to pass prebidding information back to the Chartboost Mediation Unity SDK we have provided the following.
139
+
140
+ Developers will have to call the APS Plugin and pass the information to the Chartboost Mediation SDK, the `PreBiddingListener` can be used to organize your logic and easily pass the required data, see example below:
141
+
142
+ ```csharp
143
+ public class CustomAmazonPublisherServicesPreBiddingListener : PreBiddingListener
144
+ {
145
+ private const string TAG = "[APS PreBidding Listener]";
146
+
147
+ public override Task<AmazonPublisherServicesAdapterPreBidAdInfo> OnPreBid(AmazonPublisherServicesAdapterPreBidRequest request)
148
+ {
149
+ AdRequest adRequest = null;
150
+ var amazonSetting = request.AmazonSettings;
151
+ var width = amazonSetting.Width ?? 0;
152
+ var height = amazonSetting.Height ?? 0;
153
+ var amazonPlacement = amazonSetting.PartnerPlacement;
154
+
155
+ Debug.Log($"{TAG} Format: {request.Format}, Chartboost Placement: {request.ChartboostPlacement}, Amazon Placement: {amazonPlacement}");
156
+
157
+ switch (request.Format)
158
+ {
159
+ case "rewarded":
160
+ adRequest = new APSVideoAdRequest(width, height, amazonPlacement);
161
+ break;
162
+
163
+ case "interstitial":
164
+ case "rewarded_interstitial":
165
+ adRequest = new APSInterstitialAdRequest(amazonPlacement);
166
+ break;
167
+
168
+ case "banner":
169
+ case "adaptive_banner":
170
+ adRequest = new APSBannerAdRequest(width, height, amazonPlacement);
171
+ break;
172
+
173
+ default:
174
+ Debug.LogWarning($"{TAG} Specified type is not valid, returning null values.");
175
+ return Task.FromResult(new AmazonPublisherServicesAdapterPreBidAdInfo(null, null));
176
+ }
177
+
178
+ var taskCompletionSource = new TaskCompletionSource<AmazonPublisherServicesAdapterPreBidAdInfo>();
179
+
180
+ adRequest.onSuccess += response =>
181
+ {
182
+ Debug.Log($"{TAG} Response succeeded for: CBP: {request.ChartboostPlacement} - AMZP: {amazonPlacement}!");
183
+ #if UNITY_IOS
184
+ taskCompletionSource.SetResult(new AmazonPublisherServicesAdapterPreBidAdInfo(response.GetPricePoint(), response.GetMediationHints()));
185
+ #elif UNITY_ANDROID
186
+ taskCompletionSource.SetResult(new AmazonPublisherServicesAdapterPreBidAdInfo(response.GetPricePoint(), response.GetBidInfo()));
187
+ #else
188
+ taskCompletionSource.SetResult(new AmazonPublisherServicesAdapterPreBidAdInfo(null, null));
189
+ #endif
190
+ };
191
+
192
+ adRequest.onFailedWithError += error =>
193
+ {
194
+ Debug.LogError($"{TAG} Failed with Error: {error.GetMessage()} and Code: {error.GetCode()}");
195
+ taskCompletionSource.SetResult(new AmazonPublisherServicesAdapterPreBidAdInfo(null, null));
196
+ };
197
+
198
+ adRequest.LoadAd();
199
+ return taskCompletionSource.Task;
200
+ }
201
+ }
202
+ ```
203
+
204
+ ### Setting the Pre-Bidding Listener
205
+
206
+ ```csharp
207
+ // Publisher Initializes the AmazonPubliserServices Unity Plugin
208
+ Amazon.Initialize("YOUR_AMAZON_API_KEY_GOES_HERE");
209
+
210
+ // Create instance for your Custom Pre-Bidding Listener
211
+ AmazonPublisherServicesAdapter.PreBiddingListener = new CustomAmazonPublisherServicesPreBiddingListener();
212
+ ```
package/README.md.meta ADDED
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 14fedbffded6c4b3ea31640ffcf68de6
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,39 @@
1
+ using Chartboost.Mediation.Adapters;
2
+ using Chartboost.Mediation.AmazonPublisherServices.Common;
3
+ using Chartboost.Mediation.AmazonPublisherServices.Default;
4
+
5
+ namespace Chartboost.Mediation.AmazonPublisherServices
6
+ {
7
+ #nullable enable
8
+ /// <inheritdoc cref="IAmazonPublisherServicesAdapter"/>
9
+ public static class AmazonPublisherServicesAdapter
10
+ {
11
+ internal static IAmazonPublisherServicesAdapter Instance = new AmazonPublisherServicesDefault();
12
+
13
+ /// <summary>
14
+ /// The partner adapter Unity version.
15
+ /// </summary>
16
+ public const string AdapterUnityVersion = "5.0.0";
17
+
18
+ /// <inheritdoc cref="IPartnerAdapterConfiguration.AdapterNativeVersion"/>
19
+ public static string AdapterNativeVersion => Instance.AdapterNativeVersion;
20
+
21
+ /// <inheritdoc cref="IPartnerAdapterConfiguration.PartnerSDKVersion"/>
22
+ public static string PartnerSDKVersion => Instance.PartnerSDKVersion;
23
+
24
+ /// <inheritdoc cref="IPartnerAdapterConfiguration.PartnerIdentifier"/>
25
+ public static string PartnerIdentifier => Instance.PartnerIdentifier;
26
+
27
+ /// <inheritdoc cref="IPartnerAdapterConfiguration.PartnerDisplayName"/>
28
+ public static string PartnerDisplayName => Instance.PartnerDisplayName;
29
+
30
+ /// <inheritdoc cref="IAmazonPublisherServicesAdapter.TestMode"/>
31
+ public static bool TestMode { get => Instance.TestMode; set => Instance.TestMode = value; }
32
+
33
+ /// <inheritdoc cref="IAmazonPublisherServicesAdapter.VerboseLogging"/>
34
+ public static bool VerboseLogging { get => Instance.VerboseLogging; set => Instance.VerboseLogging = value; }
35
+
36
+ /// <inheritdoc cref="IAmazonPublisherServicesAdapter.PreBiddingListener"/>
37
+ public static PreBiddingListener? PreBiddingListener { get => Instance.PreBiddingListener; set => Instance.PreBiddingListener = value; }
38
+ }
39
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 15881acec31cb45c88f7264355dbdfd3
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,25 @@
1
+ namespace Chartboost.Mediation.AmazonPublisherServices
2
+ {
3
+ #nullable enable
4
+ /// <summary>
5
+ /// APS Ad info obtained during pre-bidding.
6
+ /// </summary>
7
+ public struct AmazonPublisherServicesAdapterPreBidAdInfo
8
+ {
9
+ /// <summary>
10
+ /// The associated price point.
11
+ /// </summary>
12
+ public readonly string? PricePoint;
13
+
14
+ /// <summary>
15
+ /// The associated bid payload.
16
+ /// </summary>
17
+ public readonly string? BidInfo;
18
+
19
+ public AmazonPublisherServicesAdapterPreBidAdInfo(string? pricePoint, string? bidInfo)
20
+ {
21
+ PricePoint = pricePoint;
22
+ BidInfo = bidInfo;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 210c70ccd60f45efae83f17702376631
3
+ timeCreated: 1707784689
@@ -0,0 +1,49 @@
1
+ using System.Collections.Generic;
2
+ using Chartboost.Mediation.Ad.Banner;
3
+
4
+ namespace Chartboost.Mediation.AmazonPublisherServices
5
+ {
6
+ /// <summary>
7
+ /// A request model containing the info to be used by publishers to load an APS ad during pre-bidding.
8
+ ///
9
+ /// Chartboost is not permitted to wrap the Amazon APS initialization or bid request methods directly.
10
+ /// The adapter handles APS initialization and pre-bidding only when the managed pre-bidding flag is enabled.
11
+ /// For more information please contact the Amazon APS support team at https://aps.amazon.com/aps/contact-us/
12
+ /// </summary>
13
+ public struct AmazonPublisherServicesAdapterPreBidRequest
14
+ {
15
+ /// <summary>
16
+ /// Chartboost Mediation's placement identifier.
17
+ /// </summary>
18
+ public readonly string MediationPlacement;
19
+
20
+ /// <summary>
21
+ /// Ad format.
22
+ /// </summary>
23
+ public readonly string Format;
24
+
25
+ /// <summary>
26
+ /// Key-value pairs to be associated with the placement.
27
+ /// </summary>
28
+ public readonly IReadOnlyDictionary<string, string> Keywords;
29
+
30
+ /// <summary>
31
+ /// The size of the banner being requested.
32
+ /// </summary>
33
+ public readonly BannerSize? BannerSize;
34
+
35
+ /// <summary>
36
+ /// Amazon-specific info needed to load the APS ad.
37
+ /// </summary>
38
+ public readonly AmazonSettings AmazonSettings;
39
+
40
+ internal AmazonPublisherServicesAdapterPreBidRequest(string mediationPlacement, string format, IReadOnlyDictionary<string, string> keywords, BannerSize? bannerSize, AmazonSettings amazonSettings)
41
+ {
42
+ MediationPlacement = mediationPlacement;
43
+ Format = format;
44
+ Keywords = keywords;
45
+ BannerSize = bannerSize;
46
+ AmazonSettings = amazonSettings;
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0d55a18ee26554ae4a8ca3413ddc0799
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,38 @@
1
+ namespace Chartboost.Mediation.AmazonPublisherServices
2
+ {
3
+ #nullable enable
4
+ /// <summary>
5
+ /// Data struct to store all the Amazon pre bid settings from the configuration.
6
+ /// </summary>
7
+ public struct AmazonSettings
8
+ {
9
+ /// <summary>
10
+ /// The Amazon placement name.
11
+ /// </summary>
12
+ public readonly string PartnerPlacement;
13
+
14
+ /// <summary>
15
+ /// The width of the expected ad if it's a banner.
16
+ /// </summary>
17
+ public readonly int? Width;
18
+
19
+ /// <summary>
20
+ /// The height of the expected ad if it's a banner.
21
+ /// </summary>
22
+ public readonly int? Height;
23
+
24
+ /// <summary>
25
+ /// Indicates if this is a video placement.
26
+ /// </summary>
27
+ public readonly bool? IsVideo;
28
+
29
+ public AmazonSettings(string partnerPlacement, bool? isVideo, int? height, int? width)
30
+ {
31
+ PartnerPlacement = partnerPlacement;
32
+ IsVideo = isVideo;
33
+ Height = height;
34
+ Width = width;
35
+ }
36
+ }
37
+ #nullable disable
38
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 769864396e06746239009479ecd2e5f7
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,16 @@
1
+ using System.Runtime.CompilerServices;
2
+ using Chartboost.Mediation.AmazonPublisherServices;
3
+ using UnityEngine.Scripting;
4
+
5
+ [assembly: AlwaysLinkAssembly]
6
+ [assembly: InternalsVisibleTo(AssemblyInfo.AmazonPublisherServicesAssemblyInfoAndroid)]
7
+ [assembly: InternalsVisibleTo(AssemblyInfo.AmazonPublisherServicesAssemblyInfoIOS)]
8
+
9
+ namespace Chartboost.Mediation.AmazonPublisherServices
10
+ {
11
+ internal class AssemblyInfo
12
+ {
13
+ public const string AmazonPublisherServicesAssemblyInfoAndroid = "Chartboost.Mediation.AmazonPublisherServices.Android";
14
+ public const string AmazonPublisherServicesAssemblyInfoIOS = "Chartboost.Mediation.AmazonPublisherServices.IOS";
15
+ }
16
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 406f3f0361c744ac3a50111b73e2dac6
3
+ timeCreated: 1684175795