Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Amazon Mobile Ad SDK for Gideros Mobile Free Member License — Gideros Forum

Amazon Mobile Ad SDK for Gideros Mobile Free Member License

fxonefxone Member
edited August 2013 in Bugs and issues
Hi Guys!
I've since two days tried to implement Amazon Mobile Ad SDK based on their documentation:
https://developer.amazon.com/sdk/mobileads/quick-start.html
and according to old but classic solution from @ar2rsawseen:
http://appcodingeasy.com/Gideros-Mobile/Gideros-Implementing-AdMob-for-Android
I'm trying to have the same result, but unfortunately without full success.
What I can get:
-view an ad at test mode from Amazon. :)
What I can't get for now:
- use Gideros Layout because buttons in game are inactive... :(
- force to put an ad at bottom.

Problems during this implementation:
- I don't know why I can't use LinearLayout solution as Amazon suggested in main java, but only FrameLayout works as at
@ar2rsawseen's solution.
- alternatively using of layout at main.xml with LinearLayout tag as Amazon suggested also doesn't work. The same solution with FrameLayout tag the same :(

My code at java main activity:
public class DrunkandRollActivity extends Activity implements OnTouchListener
{
	static
	{
 
		System.loadLibrary("gideros");
		System.loadLibrary("luasocket");
		System.loadLibrary("lfs");
		System.loadLibrary("facebook");
 
	}
 
	static private String[] externalClasses = {
		"com.giderosmobile.android.plugins.facebook.GFacebook",
	};
 
	private GLSurfaceView mGLView;
	private AdLayout adView; // The ad view used to load and display the ad.
 
 
    // Tag used to prefix all log messages
	private boolean mHasFocus = false;
	private boolean mPlaying = false;
 
	<a href="https://forum.giderosmobile.com/profile/Override" rel="nofollow">@Override</a>
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
 
 
        mGLView = new GiderosGLSurfaceView(this);
		//setContentView(mGLView);
		mGLView.setOnTouchListener(this);
	    setContentView(R.layout.main);
	   // AdRegistration.setAppKey("0123456789ABCDEF0123456789ABCDEF");
	    AdRegistration.setAppKey("sample-app-v1_pub-2"); 
//
	   AdRegistration.enableLogging(true);
        // For debugging purposes flag all ad requests as tests, but set to false for production builds
        AdRegistration.enableTesting(true);
 
     // Programmatically create the AmazonAdLayout       
        this.adView = new AdLayout(this);
        FrameLayout layout = (FrameLayout) findViewById(R.id.layout_main);
        // Set the correct width and height of the ad.
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
        	     FrameLayout.LayoutParams.MATCH_PARENT ,
	                FrameLayout.LayoutParams.MATCH_PARENT ,
	                Gravity.BOTTOM);
		layout.addView(mGLView);
 
       layout.addView(this.adView,lp);
 
        // If you declared AdLayout in your xml you would instead
        // replace the 3 lines above with the following line
        // this.adView = (AdLayout) findViewById( R.id.adview );
 
        this.adView.loadAd(new AdTargetingOptions()); // async task to retrieve an ad
And my main.xml looks like:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="<a href="http://schemas.android.com/apk/res/android&quot" rel="nofollow">http://schemas.android.com/apk/res/android&quot</a>;
 android:layout_width="match_parent" 
 android:layout_height="match_parent"
 android:orientation="vertical"
 android:gravity="bottom"
 android:id="<a href="https://forum.giderosmobile.com/profile/%2Bid%2Flayout_main%26quot" rel="nofollow">@+id/layout_main&quot</a>; >
</FrameLayout>
Any ideas to help me solve this problem, I will appreciate. Thanks!

Likes: larf

+1 -1 (+1 / -0 )Share on Facebook

Comments

  • talistalis Guru
    edited August 2013
    In the java code where you are finding the layout, you define FrameLayout as
    Match_Parent maybe change it to WRAP_CONTENT.

    I am thinking it is blocking your main view (gideros view) and you can see the buttons but events are not catched by gideros hence add is matching the parent and blocking it.
    Change the java code like this:
    // Programmatically create the AmazonAdLayout       
            this.adView = new AdLayout(this);
            FrameLayout layout = (FrameLayout) findViewById(R.id.layout_main);
            // Set the correct width and height of the ad.
            FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
            	     FrameLayout.LayoutParams.WRAP_CONTENT,
    	                FrameLayout.LayoutParams.WRAP_CONTENT,
    	                Gravity.BOTTOM);
    		layout.addView(mGLView);
    Note: It is a blind shot hope it will help:D
  • @talis I forgot to mention that:
    - with WRAP_CONTENT value it doesn't show any ad..

    I am thinking it is blocking your main view (gideros view)
    I would agree but I've just only tried @ar2rsawseen's solution for Admob, which is similar:
     // Add the Gideros view to main layout
        layout.addView(mGLView);
        // Add the adView to main layout
        layout.addView(adView, adParams);
    Anyway thanks.
    ps. you forgot to add quatation marks at pre lang="java" ;)
  • @fxone corrected quatation :D
    hmm for your question need to think deeply :-B

    Likes: fxone

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.