Start App Banner Ads (start.io) in Android App
Start App Banner Ads (start.io) in Android App
Banner ads are small (300*50) Ads which are shown mostly in bottom of screen.
Start App Banner Ads |
Firstly, place an adcode in XML file and then load ad in java file.
xml file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".StartAppAds.BannerAds">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Start App Banner Ads"
android:textSize="26sp"
android:layout_margin="15dp"
app:layout_constraintBottom_toTopOf="@id/startAppBanner"
android:textStyle="bold"/>
<com.startapp.sdk.ads.banner.Banner
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="parent"
android:id="@+id/startAppBanner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
</androidx.constraintlayout.widget.ConstraintLayout>
Java file
public class BannerAds extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_banner_ads);
StartAppSDK.init(this,"Your App Id from Start App Website",false);
StartAppSDK.setTestAdsEnabled(true); //remove this line when publish for play store.
Banner banner = findViewById(R.id.startAppBanner);
banner.loadAd();
}
}
This will then load your test banners for you.
Follow us for more posts like this,
Subscribe to Harpreet studio on Youtube
Like Harpreet Studio on Facebook
Follow me on Instagram , Harpreet Studio on Instagram,
Subscribe to Harpreet studio on Youtube
Like Harpreet Studio on Facebook
Follow me on Instagram , Harpreet Studio on Instagram,
Install our Android app from Google Play store
Yahaya Yaro tv
ReplyDeleteYahaya Yaro tv
ReplyDelete