How do I hide StartApp ad on my app?
Question
I want to hide/stop the 3d banner ad when user makes an inapp purchase. But I can't figure out how to.
The ad starts automatically when the activity is launched and there is no way of stopping it
<com.startapp.android.publish.banner.banner3d.Banner3D
android:id="@+id/startApp3DBanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
.
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
startAppAd.onResume();
.
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
StartAppAd.init(this, C.STARTAPP_DEV_ID, C.STARTAPP_APP_ID);
setContentView(R.layout.main_activity);
startAppAd = new StartAppAd(this);
Solution
You can use the following line to hide the banner:
((Banner3D) findViewById(R.id.startApp3DBanner)).hideBanner();
And:
((Banner3D) findViewById(R.id.startApp3DBanner)).showBanner();
For showing it.
OTHER TIPS
This is mentioned in their support page.
You need to call this to hide the ad banner:
startAppBanner.hideBanner();
And you can put this in the onCreate
method. Alternatively, you can have a boolean value that checks if the user has made an in-app purchase, and then hide the view through banner.setVisibility(View.GONE)
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow