How to create facebook Banner Ads | Audience Network

Hello friends how are you all.... You can easily create a Facebook Banner Ads by watching the video.




Build.gradle:

....Copy any code....

implementation 'com.facebook.android:audience-network-sdk:5.4.1'
implementation 'com.facebook.android:audience-network-sdk:5.4.1'

AndroidManifest.xml:

....Copy the code as shown on the video....

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


<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.ads.AudienceNetworkActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
</application>

</manifest>

activity_main.xml:

....Copy the code as shown on the video....

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
...
>
...
<LinearLayout
android:id="@+id/banner_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
/>
...
</RelativeLayout>

MainActivity java: 

....Copy the code as shown on the video....


import com.facebook.ads.*;

public class MainActivity extends AppCompatActivity {

private AdView adView;
...
// Instantiate an AdView object.
// NOTE: the placement ID will eventually identify this as your App, you can ignore it for
// now, while you are testing and replace it later when you have signed up.
// While you are using this temporary code you will only get test ads and if you release
// your code like this to the Google Play your users will not receive ads (you will get a no fill error).
adView = new AdView(this, "YOUR_PLACEMENT_ID", AdSize.BANNER_HEIGHT_50);

// Find the Ad Container
LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container);

// Add the ad view to your activity layout
adContainer.addView(adView);

// Request an ad
adView.loadAd();
}
...

...Please do not copy the code...

The code is only made for our video, please do not copy it....
Banner    2495989693778711_2495992030445144

Comments

Popular posts from this blog

Banglalink 39 Taka Recharge Offer New

How To Connect Devices To Test Facebook Audience Network Ad [Test device IDFA - AAID ]

FTP Movie Server Bangladesh