B4A Library Amazon Ad Wrapper

Just after I released this wrapper, Amazon changed their SDK function prototypes for the listeners. That change broke the wrapper. See post #20 in this thread for a modified version of the wrapper.

Hello,
I have attached a zip archive with a wrapper library for the Amazon Ads SDK. The zip archive includes the wrapper source code in Java, the compiled library jar and XML files, and a small test B4A application.

I based the wrapper on source code uploaded by Erel several years ago for the Admob wrapper merged with the Amazon SimpleExample. I used the Simple Library Compiler (SLC) to compile.

You will need to get an Amazon developer account, it's free, and an app ID. I just created a dummy test app entry to get the ID.

https://developer.amazon.com/public/

You also need to download the Amazon Ad SDK. I renamed it to amazon-ads.jar by removing the version number from the jar file name.

https://developer.amazon.com/public/resources/development-tools/sdk

The Amazon-ads.jar is buried in the SDK download. You have to open the SDK archive and extract amazon-ads-xxxx.jar library.

This jar (amazon-ads.jar) along with my AmznAd.jar and AmznAd.xml files from the attached zip archive should be placed in your B4A Additional Libraries directory. Your Amazon App ID needs to be entered in the B4A file.

I have tested this wrapper for two Amazon ad sizes, 320x50 and 300x250.

When you look at the wrapper Java source code and find major errors, please upload the fixes to this forum.

Barry.
 

Attachments

  • AmznAdTest.zip
    12.8 KB · Views: 281
Last edited:

GMan

Well-Known Member
Licensed User
Longtime User
Now it throughs an error: class file com.amazon.device.ads.AdLayout not found
her:
B4X:
  pnlAd.AddView(advw, 0, 0, pnlAd.Width, pnlAd.Height)

If i comment that out i got an error
A referenced libary is missing: amazon-Ads

But its still there
 

canalrun

Well-Known Member
Licensed User
Longtime User
It appears that you are trying my AMZNAdTest.b4a example – I recognize that line of code.

My guess would be that it is not finding the amazon-ads.jar library.

This library is part of the Amazon SDK for android which is available at: https://developer.amazon.com/public/resources/development-tools/sdk

I am in the USA. I hope this location is valid for Germany.

Download the SDK, Apps-SDK.zip. Open the zip file, buried deep within the zip file, Android\Ads\lib\, you'll find the amazon ads jar file. The most recent version appears to be amazon-ads-5.3.22.jar.

Extract this jar file. Rename it to amazon-ads.jar (this is supposed to make my wrapper version independent) (the name may need to be all lowercase, not sure), then copy amazon-ads.jar to your B4A additional libraries folder.

This library is referenced by my wrapper.

You also need to copy the two wrapper files, AmznAd2.jar and AmznAd2.xml. It appears you have already done this.

I hope this solves the problem.

Barry.
 

GMan

Well-Known Member
Licensed User
Longtime User
I did that all, already, also newest jar etc.

Renamed, copied etc....
 

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I'm afraid I'm stumped here.

I did a clean install of B4A 3.80 on a backup computer, copied the two wrapper library files into a new "Adlibs" directory within B4A, downloaded the SDK, extracted, renamed, and copied the amazon ads.jar into my Adlibs directory.

I then extracted and compiled my test B4A program using 3.80, installed via the bridge. It ran properly.

The B4A installation was brand-new. My Adlibs directory contains only the two wrapper files and the amazon-ads.jar file.

My next suspicion would be for a conflicting library. Is this possible? I saw a different Amazon ad library on the forums. Is it possible you installed this and it may be conflicting somehow?

I am in the USA and I believe you are in Germany? There is always the possibility that there is a difference between the underlying libraries we use – I have run into this problem in the past. I am a little suspicious of the things Amazon sometimes does.

Barry.
 

GMan

Well-Known Member
Licensed User
Longtime User
Ahh, 3.8 ... didn't noticed that.
I am using still 2.71
 

Gunther

Active Member
Licensed User
Longtime User
Hi,

how one can detect if a user has clicked on the ads and/or the Ad was shown?

Thanks!
 
Last edited:

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I don't think I expose that event from the Amazon ads.
You would have to search the Amazon Ad documentation to see if they offer this event, then modify and rebuild the library code (see post #2 to download) in Eclipse.

Barry.
 

Gunther

Active Member
Licensed User
Longtime User
Hi,
Unfortunatly there is no event that the User has clicked on the Banner.

Thanks!
 

Feten7

Member
Licensed User
Hi all, specially Canalrun.

I was trying to incluye Amazon ads with tour library but it seems new SDK is not working. Has someone tried it with the brand new one???

The error i get is:
java.lang.NoSuchMethodError: No direct method <init>

I wish i could download a previous versión but it seems impossible in Amazon's site.

Thanks to all in advance
 

canalrun

Well-Known Member
Licensed User
Longtime User
This wrapper is almost 2 years old. I'm sure Amazon has modified their SDK making this wrapper obsolete since then.

I currently use Appodeal with good results. (They have previously posted to these forms.) They supply support for B4A. I hope their support continues.

Barry.
 

Feten7

Member
Licensed User
Ok. I've read about them and it's good to have someone dealing with SDK changes. I'm a newbie and was integrating ads on my own. Maybe Appodeal, StartApp or anyone that has B4A support can be the solution. I've been reading good reviews about Appodeal, but it's my first approach.

Thanks, Barry.
 

nicolino33

Active Member
Licensed User
Longtime User
Error:

java.lang.NoSuchMethodError: No direct method <init>(Landroid/app/Activity;Lcom/amazon/device/ads/AdSize; )V in class Lcom/amazon/device/ads/AdLayout; or its super classes (declaration of 'com.amazon.device.ads.AdLayout' appears in base.apk)
 
Top