Problems implementing Adwhirl
I´m novice programming with Android. Somebody knows how to implement Adwhirl in Android app? I have see Adwhirl´s web page but I don´t know how to do this. Somebody knows a simp开发者_JAVA技巧le manual to do this or has a code examples? I need help! Thank you!
You can find the information on adwhirl article or you can follow this way( which I was used for myself...)
In manifest add these permissions.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
In on Create
LinearLayout adLayout1 = (LinearLayout) findViewById(R.id.XXXX);
final int DIP_WIDTH = 320;
final int DIP_HEIGHT = 52;
final float DENSITY = getResources().getDisplayMetrics().density;
int scaledWidth = (int) (DENSITY * DIP_WIDTH + 0.5f);
int scaledHeight = (int) (DENSITY * DIP_HEIGHT + 0.5f);
RelativeLayout.LayoutParams adWhirlLayoutParams = new RelativeLayout.LayoutParams(
scaledWidth, scaledHeight);
AdWhirlLayout adWhirlLayout1 = new AdWhirlLayout(this,AdWhirlKey);
if(adTest)//place adTest true while testing ..false while release....
AdWhirlTargeting.setTestMode(true); adLayout1.addView(adWhirlLayout1, adWhirlLayoutParams);
Note: Make sure to add the manifest items of these adnetworks(which you want to use like admob,inmobi..etc) in the Application's manifest.
精彩评论