question

phivang avatar image
phivang asked

Amazon API implementation

I'm trying to follow Amazon instructions for implementing the Mobile Ads API, ran into a few issues/questions. Would appreciate all pointers. BTW I developed using Gideros. 4 steps according to Amazon: 1. Incorporate the API into Your Project 2. Update the Android Manifest 3. Set Your Application Key 4. Add the Amazon Ad Layout to Your App Steps 1 and 2 are automatic as I am using the Eclipse plugin, and it seems they completed OK So I continued with step #3, Amazon says public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AdRegistration.setAppKey("0123456789ABCDEF0123456789ABCDEF"); } I got an error "R cannot resolve to a variable", how do I fix this? I commented out line // setContentView(mGLView); The next error is AdRegistration cannot be resolved, and my appkey was not resolve either Did I miss a step? Then I did the next step and added, all the lines gave errors. // Programmatically create the AmazonAdLayout this.adView = new AdLayout(this); LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout); // Set the correct width and height of the ad LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); layout.addView(this.adView,lp); this.adView.loadAd(new AdTargetingOptions()); // This AsyncTask retrieves an ad Thanks in advance
mobile ads
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Phivang, The problem you are facing due to having the 1st step incorrect. Please ensure that you have set your dependency to Amazon Ads library jar correctly. If you are unable to do so while using the eclipse plugin, I would recommend you to do it with out using the plugin. There are sample apps shipped with the Ads SDK, please go through.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.