| 
									
										
										
										
											2023-12-26 03:47:44 +00:00
										 |  |  | using System; | 
					
						
							|  |  |  | using System.Collections; | 
					
						
							|  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  | using UnityEngine; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace AmazonAds.Android { | 
					
						
							|  |  |  |     public class AndroidAdInterstitial : IAdInterstitial { | 
					
						
							|  |  |  |         private AndroidJavaObject dtbAdInterstitial = null; | 
					
						
							|  |  |  |         private static readonly AndroidJavaClass SDKUtilitiesClass = new AndroidJavaClass(AmazonConstants.sdkUtilitiesClass); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-24 01:28:57 +00:00
										 |  |  |         UnityEngine.AndroidJavaClass playerClass; | 
					
						
							|  |  |  |         UnityEngine.AndroidJavaObject currentActivityObject; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-26 03:47:44 +00:00
										 |  |  |         public AndroidAdInterstitial (APSAdDelegate delegates) { | 
					
						
							| 
									
										
										
										
											2024-06-24 01:28:57 +00:00
										 |  |  |             playerClass = new UnityEngine.AndroidJavaClass(AmazonConstants.unityPlayerClass); | 
					
						
							|  |  |  |             currentActivityObject = playerClass.GetStatic<UnityEngine.AndroidJavaObject> ("currentActivity"); | 
					
						
							| 
									
										
										
										
											2023-12-26 03:47:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             DTBAdInterstitialListener adInterstitialListener = new DTBAdInterstitialListener(); | 
					
						
							|  |  |  |             adInterstitialListener.adDelegate = delegates; | 
					
						
							|  |  |  |             dtbAdInterstitial = new AndroidJavaObject(AmazonConstants.dtbAdInterstitialClass, currentActivityObject, adInterstitialListener); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-24 01:28:57 +00:00
										 |  |  |         public void Dispose() { | 
					
						
							|  |  |  |             playerClass.Dispose(); | 
					
						
							|  |  |  |             currentActivityObject.Dispose(); | 
					
						
							|  |  |  |             dtbAdInterstitial.Dispose(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-26 03:47:44 +00:00
										 |  |  |         public override void FetchAd (AdResponse adResponse) { | 
					
						
							|  |  |  |             if (dtbAdInterstitial != null) { | 
					
						
							|  |  |  |                 AndroidJavaObject response = adResponse.GetAndroidResponseObject(); | 
					
						
							|  |  |  |                 string bidInfo = SDKUtilitiesClass.CallStatic<string>("getBidInfo", response); | 
					
						
							|  |  |  |                 dtbAdInterstitial.Call("fetchAd", bidInfo); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         public override void Show () { | 
					
						
							|  |  |  |             if (dtbAdInterstitial != null) { | 
					
						
							|  |  |  |                 dtbAdInterstitial.Call("show"); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |