Pendrush Well-Known Member Licensed User Longtime User Sep 23, 2020 #1 Wrapper for AmazonAds v6.0.0 (June 26, 2020). Static banner and interstitial ads only. AmazonAds Author: Author: Amazon - B4a Wrapper: Pendrush Version: 1.00 AmazonAds Events: AdFailedToLoad (Error As String) AdLoaded Fields: AD_SIZE_1024x50 As Object Banner - 1024x50, you need to set view width to 1024dip and height to 50dip AD_SIZE_300x250 As Object Banner - 300x250, you need to set view width to 300dip and height to 250dip AD_SIZE_320x50 As Object Banner - 320x50, you need to set view width to 320dip and height to 50dip AD_SIZE_600x90 As Object Banner - 600x90, you need to set view width to 600dip and height to 90dip AD_SIZE_728x90 As Object Banner - 728x90, you need to set view width to 728dip and height to 90dip Functions: BringToFront Initialize (EventName As String, AppKey As String, AdsSize As com.amazon.device.ads.AdSize, EnableTesting As Boolean) EnableTesting = use True in testing, False for production app. AmazonAds1.Initialize("AmazonAds1", "sample-app-v1_pub-2", AmazonAds1.AD_SIZE_320x50, True) Activity.AddView(AmazonAds1, 50%x-160dip, 0dip, 320dip, 50dip) Invalidate Invalidate2 (arg0 As android.graphics.Rect) Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) IsInitialized As Boolean LoadAd Load Ad. The Amazon Mobile Ad Network recommends loading a new ad on screen navigations and device orientation changes when the ad view changes size. You may also want to refresh the ad after a set time interval. In this case, the Amazon Mobile Ad Network recommends a refresh rate of 30 to 60 seconds. Faster ad refresh intervals could result in blocked ad requests. Please note that the Amazon Mobile Ads API does not provide any built-in functionality for automatically refreshing ads. RemoveView RequestFocus As Boolean SendToBack SetBackgroundImage (arg0 As android.graphics.Bitmap) As BitmapDrawable SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int) SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int) SetVisibleAnimated (arg0 As Int, arg1 As Boolean) Properties: Background As android.graphics.drawable.Drawable Color As Int [write only] Enabled As Boolean Height As Int Left As Int Padding As Int() Parent As Object [read only] Tag As Object Top As Int Visible As Boolean Width As Int AmazonAdsInterstitial Events: AdDismissed AdFailedToLoad (Error As String) AdLoaded Functions: Initialize (EventName As String, AppKey As String, EnableTesting As Boolean) EnableTesting = use True in testing, False for production app. AmazonAdsInterstitial1.Initialize("AmazonAdsInterstitial1", "sample-app-v1_pub-2", True) IsInitialized As Boolean LoadAd Load Ad. ShowAd Show Ad after AdLoaded event fire. Click to expand... Add this to app manifest: B4X: AddApplicationText(<activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>) Download library zip file from this link and extract archive to Additional Libraries folder. I'm not able to upload on forum, as size of file is over maximum allowed limit. https://www.dropbox.com/s/blbfd6glmirhp2n/AmazonAdsLibrary.zip?dl=0 Attachments AmazonAdsExample.zip AmazonAdsExample.zip 12.3 KB · Views: 600 Last edited: Sep 24, 2020
Wrapper for AmazonAds v6.0.0 (June 26, 2020). Static banner and interstitial ads only. AmazonAds Author: Author: Amazon - B4a Wrapper: Pendrush Version: 1.00 AmazonAds Events: AdFailedToLoad (Error As String) AdLoaded Fields: AD_SIZE_1024x50 As Object Banner - 1024x50, you need to set view width to 1024dip and height to 50dip AD_SIZE_300x250 As Object Banner - 300x250, you need to set view width to 300dip and height to 250dip AD_SIZE_320x50 As Object Banner - 320x50, you need to set view width to 320dip and height to 50dip AD_SIZE_600x90 As Object Banner - 600x90, you need to set view width to 600dip and height to 90dip AD_SIZE_728x90 As Object Banner - 728x90, you need to set view width to 728dip and height to 90dip Functions: BringToFront Initialize (EventName As String, AppKey As String, AdsSize As com.amazon.device.ads.AdSize, EnableTesting As Boolean) EnableTesting = use True in testing, False for production app. AmazonAds1.Initialize("AmazonAds1", "sample-app-v1_pub-2", AmazonAds1.AD_SIZE_320x50, True) Activity.AddView(AmazonAds1, 50%x-160dip, 0dip, 320dip, 50dip) Invalidate Invalidate2 (arg0 As android.graphics.Rect) Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) IsInitialized As Boolean LoadAd Load Ad. The Amazon Mobile Ad Network recommends loading a new ad on screen navigations and device orientation changes when the ad view changes size. You may also want to refresh the ad after a set time interval. In this case, the Amazon Mobile Ad Network recommends a refresh rate of 30 to 60 seconds. Faster ad refresh intervals could result in blocked ad requests. Please note that the Amazon Mobile Ads API does not provide any built-in functionality for automatically refreshing ads. RemoveView RequestFocus As Boolean SendToBack SetBackgroundImage (arg0 As android.graphics.Bitmap) As BitmapDrawable SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int) SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int) SetVisibleAnimated (arg0 As Int, arg1 As Boolean) Properties: Background As android.graphics.drawable.Drawable Color As Int [write only] Enabled As Boolean Height As Int Left As Int Padding As Int() Parent As Object [read only] Tag As Object Top As Int Visible As Boolean Width As Int AmazonAdsInterstitial Events: AdDismissed AdFailedToLoad (Error As String) AdLoaded Functions: Initialize (EventName As String, AppKey As String, EnableTesting As Boolean) EnableTesting = use True in testing, False for production app. AmazonAdsInterstitial1.Initialize("AmazonAdsInterstitial1", "sample-app-v1_pub-2", True) IsInitialized As Boolean LoadAd Load Ad. ShowAd Show Ad after AdLoaded event fire. Click to expand... Add this to app manifest: B4X: AddApplicationText(<activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>) Download library zip file from this link and extract archive to Additional Libraries folder. I'm not able to upload on forum, as size of file is over maximum allowed limit. https://www.dropbox.com/s/blbfd6glmirhp2n/AmazonAdsLibrary.zip?dl=0