Category: Android

Android Tutorials | How to add banner ads with Facebook Audience Network

Manifest: <uses-permission android:name=”android.permission.INTERNET” /> <uses-permission android:name=”android.permission.ACCESS_WIFI_STATE” /> <uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” /> build.gradle – dependency implementation ‘’ Layout <LinearLayout android:id="@+id/banner_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" /> Source Code import; import*; private NativeBannerAd nativeBannerAd; oncreate() AudienceNetworkAds.initialize(this); adView = new AdView(this, "415395656050XXX_649219926001XXX", AdSize.BANNER_HEIGHT_50); // Find the Ad Container LinearLayout adContainer = (LinearLayout) findViewById(; // Add the ad

Gradle | Android

It is sometimes very difficult to debug your app if the settings in gradle are incorrect. You can find a sample of the latest gradle settings that I am using for your reference. build.gradle (Project: xyz) // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter()