adwhril sample not working

孤街浪徒 提交于 2019-12-25 03:08:07

问题


can anyone provide me a sample for integrating adwhril into android.I tried this sample

http://paste2.org/p/2168910

I used the same code as that one replacing the sdk key of mine But i am getting warnings saying

Can anyone suggest me

updated the code as suggested and got this warning


回答1:


Yea, i have also faced this problem and solved in this way

Add those if you didn't already added in your menifest

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

In your activity where you want to show the add

<meta-data android:value="---- Your Key ----"
            android:name="ADWHIRL_KEY"/>

Now add all the jar of the add provider you used, in your ad-whirl network. Add them to your app's libs folder and then add them to build path by right clicking on them from libs.

For example if you use Admob then add admob's jar to libs and add it to build path. And then add this line to menifest as this is needed to show add from admob individually or by using adwhirl

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

Now you will see the adds of admob.

Thank you

Ps: i have added the full code with image

Menifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.expadwhirl"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:value="2f120f401e9a40d0afa55557d3a3a58c"
                android:name="ADWHIRL_KEY"/>
        </activity>

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

</manifest>

Layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.adwhirl.AdWhirlLayout
        android:id="@+id/adwrl"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        />

</RelativeLayout>

Activity

import android.app.Activity;
import android.os.Bundle;

import com.adwhirl.AdWhirlLayout;
import com.adwhirl.AdWhirlLayout.AdWhirlInterface;

public class MainActivity extends Activity implements AdWhirlInterface {

    AdWhirlLayout adwrl;

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

    @Override
    public void adWhirlGeneric() {
        // TODO Auto-generated method stub
    }
}

Overall project



来源:https://stackoverflow.com/questions/12200424/adwhril-sample-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!