How to create audience network facebook account
Hello friends how are you all.... You can easily create a Facebook interstitial 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.+'
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>
....MainActivity java...
....Copy the code as shown on the video....
import com.facebook.ads.*;
public class InterstitialAdActivity extends Activity {
private final String TAG = InterstitialAdActivity.class.getSimpleName();
private InterstitialAd interstitialAd;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Instantiate an InterstitialAd 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).
interstitialAd = new InterstitialAd(this, "YOUR_PLACEMENT_ID");
// Set listeners for the Interstitial Ad
interstitialAd.setAdListener(new InterstitialAdListener() {
@Override
public void onInterstitialDisplayed(Ad ad) {
// Interstitial ad displayed callback
Log.e(TAG, "Interstitial ad displayed.");
}
@Override
public void onInterstitialDismissed(Ad ad) {
// Interstitial dismissed callback
Log.e(TAG, "Interstitial ad dismissed.");
}
@Override
public void onError(Ad ad, AdError adError) {
// Ad error callback
Log.e(TAG, "Interstitial ad failed to load: " + adError.getErrorMessage());
}
@Override
public void onAdLoaded(Ad ad) {
// Interstitial ad is loaded and ready to be displayed
Log.d(TAG, "Interstitial ad is loaded and ready to be displayed!");
// Show the ad
interstitialAd.show();
}
@Override
public void onAdClicked(Ad ad) {
// Ad clicked callback
Log.d(TAG, "Interstitial ad clicked!");
}
@Override
public void onLoggingImpression(Ad ad) {
// Ad impression logged callback
Log.d(TAG, "Interstitial ad impression logged!");
}
});
// For auto play video ads, it's recommended to load the ad
// at least 30 seconds before it is shown
interstitialAd.loadAd();
}
}
How to create audience network facebook account
Reviewed by Code Labe
on
June 25, 2019
Rating: