How to integrate adwhirl code into android application

i want to integrate admob code inside my test app, here are the steps i have followed.

Layout file looks like this

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="bottom"
        android:id="@+id/layout_ad">

</LinearLayout>

Manifest file looks like this

<?xml version="1.0" encoding="utf-8"?>

<uses-sdk android:minSdkVersion="8" />
    <uses-permission android:name="android.permission.INTERNET" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".Dummyads2Activity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

And finally here how the code looks

public class Dummyads2Activity extends Activity {//implements AdWhirlInterface{
/** Called when the activity is first created. */

private AdWhirlLayout adWhirlLayout;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


   try{
        AdManager.setTestDevices( new String[] { AdManager.TEST_EMULATOR } );
        LinearLayout layout = (LinearLayout)findViewById(R.id.layout_ad);
        AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "my adwhirl id");
        Display d = this.getWindowManager().getDefaultDisplay();
        RelativeLayout.LayoutParams adWhirlLayoutParams = new RelativeLayout.LayoutParams(d.getWidth(), 72);
        layout.addView(adWhirlLayout, adWhirlLayoutParams);
    }catch(Exception e){
        //Log.e(TAG, "Unable to create AdWhirlLayout", e);
    }

}

If i do like this, my app crashes, and no ads appear. Kindly help me in solving the problem.

Answers


This really depends on what versions of AdMob and AdWhirl you're using. I'm going to talk about AdMob SDK v6.1.0 and AdWhirl v3.2.0, which are currently the newest versions.

You're probably crashing because of this line:

AdManager.setTestDevices( new String[] { AdManager.TEST_EMULATOR } );

This looks like legacy AdMob AdManager; AdWhirl uses the Google AdMob SDK. Anyhow, if you want test ads with AdWhirl, you want to set testing through AdWhirl, not through an ad network. So remove the above line and set test mode like this:

AdWhirlTargeting.setTestMode(true);

Also, your manifest will need to have a superset of all the permissions and activity definitions of the networks you're mediating with. For AdMob, you'll need to add:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
...
<activity android:name="com.google.ads.AdActivity"
              android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize" />

If you still run into errors, posting some logging output would be useful. If you're using Eclipse, you can find logcat from Window -> Show View -> Other... -> Android -> LogCat. Or you can get the logcat output from the command line using adb logcat with Android's adb tool.


Need Your Help

r-Error in knn: NA/NaN/Inf in foreign function call (arg 6)

python r twitter

I am analyzing the tweets by applying SVM, NB and kNN to know whether tweet is positive, negative or neutral, for this purpose I have 80704 tweets but for test purpose I am only analyzing only 2847

Why doesnt my top and bottom physics body resize for the iPad?

ios swift skphysicsbody

I have a physicsBody for the bottom of my screen and for the top. It fits perfectly for my iPhone but when i go to the iPad simulator its a couple inches away from the top of the screen and bottom ...