how to show admob interstitial on app start
up vote
0
down vote
favorite
I need help
how to show admob interstitial on app start
i want to trigger the admon interstitial when app launched
for the record my app is a swipe tab content
Pleas i need any solution
any one have an idea
public class MainActivity extends FragmentActivity implements
ActionBar.TabListener {
private InterstitialAd interstitial;
private ViewPager viewPager;
private TabsPagerAdapter mAdapter;
private ActionBar actionBar;
// Tab titles
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("");
//google ads Banner
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
ActionBar actionBar = getActionBar();
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("ca-app-pub-1417847946178022/7723890794");
// Create ad request.
adRequest = new AdRequest.Builder().build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
// Initilization
viewPager = (ViewPager) findViewById(R.id.pager);
actionBar = getActionBar();
mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mAdapter);
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Adding Tabs
for (String tab_name : tabs) {
actionBar.addTab(actionBar.newTab().setText(tab_name)
.setTabListener(this));
}
/**
* on swiping the viewpager make respective tab selected
* */
final ActionBar finalActionBar = actionBar;
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
// on changing the page
// make respected tab selected
finalActionBar.setSelectedNavigationItem(position);
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int arg0) {
}
});
interstitial.setAdListener(new AdListener() {
public void onAdLoaded() {
displayInterstitial();
}
});
}
// Invoke displayInterstitial() when you are ready to display an interstitial.
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// on tab selected
// show respected fragment view
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}
}
android admob interstitial
add a comment |
up vote
0
down vote
favorite
I need help
how to show admob interstitial on app start
i want to trigger the admon interstitial when app launched
for the record my app is a swipe tab content
Pleas i need any solution
any one have an idea
public class MainActivity extends FragmentActivity implements
ActionBar.TabListener {
private InterstitialAd interstitial;
private ViewPager viewPager;
private TabsPagerAdapter mAdapter;
private ActionBar actionBar;
// Tab titles
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("");
//google ads Banner
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
ActionBar actionBar = getActionBar();
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("ca-app-pub-1417847946178022/7723890794");
// Create ad request.
adRequest = new AdRequest.Builder().build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
// Initilization
viewPager = (ViewPager) findViewById(R.id.pager);
actionBar = getActionBar();
mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mAdapter);
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Adding Tabs
for (String tab_name : tabs) {
actionBar.addTab(actionBar.newTab().setText(tab_name)
.setTabListener(this));
}
/**
* on swiping the viewpager make respective tab selected
* */
final ActionBar finalActionBar = actionBar;
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
// on changing the page
// make respected tab selected
finalActionBar.setSelectedNavigationItem(position);
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int arg0) {
}
});
interstitial.setAdListener(new AdListener() {
public void onAdLoaded() {
displayInterstitial();
}
});
}
// Invoke displayInterstitial() when you are ready to display an interstitial.
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// on tab selected
// show respected fragment view
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}
}
android admob interstitial
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I need help
how to show admob interstitial on app start
i want to trigger the admon interstitial when app launched
for the record my app is a swipe tab content
Pleas i need any solution
any one have an idea
public class MainActivity extends FragmentActivity implements
ActionBar.TabListener {
private InterstitialAd interstitial;
private ViewPager viewPager;
private TabsPagerAdapter mAdapter;
private ActionBar actionBar;
// Tab titles
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("");
//google ads Banner
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
ActionBar actionBar = getActionBar();
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("ca-app-pub-1417847946178022/7723890794");
// Create ad request.
adRequest = new AdRequest.Builder().build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
// Initilization
viewPager = (ViewPager) findViewById(R.id.pager);
actionBar = getActionBar();
mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mAdapter);
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Adding Tabs
for (String tab_name : tabs) {
actionBar.addTab(actionBar.newTab().setText(tab_name)
.setTabListener(this));
}
/**
* on swiping the viewpager make respective tab selected
* */
final ActionBar finalActionBar = actionBar;
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
// on changing the page
// make respected tab selected
finalActionBar.setSelectedNavigationItem(position);
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int arg0) {
}
});
interstitial.setAdListener(new AdListener() {
public void onAdLoaded() {
displayInterstitial();
}
});
}
// Invoke displayInterstitial() when you are ready to display an interstitial.
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// on tab selected
// show respected fragment view
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}
}
android admob interstitial
I need help
how to show admob interstitial on app start
i want to trigger the admon interstitial when app launched
for the record my app is a swipe tab content
Pleas i need any solution
any one have an idea
public class MainActivity extends FragmentActivity implements
ActionBar.TabListener {
private InterstitialAd interstitial;
private ViewPager viewPager;
private TabsPagerAdapter mAdapter;
private ActionBar actionBar;
// Tab titles
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("");
//google ads Banner
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
ActionBar actionBar = getActionBar();
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("ca-app-pub-1417847946178022/7723890794");
// Create ad request.
adRequest = new AdRequest.Builder().build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
// Initilization
viewPager = (ViewPager) findViewById(R.id.pager);
actionBar = getActionBar();
mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mAdapter);
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Adding Tabs
for (String tab_name : tabs) {
actionBar.addTab(actionBar.newTab().setText(tab_name)
.setTabListener(this));
}
/**
* on swiping the viewpager make respective tab selected
* */
final ActionBar finalActionBar = actionBar;
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
// on changing the page
// make respected tab selected
finalActionBar.setSelectedNavigationItem(position);
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int arg0) {
}
});
interstitial.setAdListener(new AdListener() {
public void onAdLoaded() {
displayInterstitial();
}
});
}
// Invoke displayInterstitial() when you are ready to display an interstitial.
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// on tab selected
// show respected fragment view
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}
}
android admob interstitial
android admob interstitial
asked Aug 25 '15 at 16:11
Silent Joker
1
1
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
Note that according to the disallowed admob implementations:
App load or exit
Do not place interstitial ads on app load and when exiting apps as interstitials should only be placed in between pages of app content.
Failure to adhere to this policy might lead to the disabling of ad-serving to your app.
If you still want this, you can display in your onResume's
method:
boolean isAdShown;
@Override
protected void onResume() {
super.onResume();
if (!isAdShown) {
displayInterstitial();
isAdShown = true;
}
}
No I don't want this Give me an allowed method . please
– Silent Joker
Aug 26 '15 at 15:14
So you mean I should use onPause() method . ok then just show me with codes
– Silent Joker
Aug 26 '15 at 16:29
add a comment |
up vote
-1
down vote
You should not place interstitial ads on app load and when exiting apps as However. You can show Interstitial after app load, with such practice you have to implement a splash screen in your app and show interstitial after it.
An interstitial ad launches while the user is idle on the ‘Home
Screen’ of the app. This implementation is in violation of our
policies . One potential way to fix this violation, would be to
implement a splash page that launches as the first screen of the app,
before the ‘Home Screen’. The Interstitial ad should then launch in
the transition between the splash screen and the ‘Home Screen’.
Reference : -- > Google Blog
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Eray Balkanli
Nov 8 at 14:28
Couldn't agree more, just updated the answer, Thanks
– Aegon
Nov 8 at 20:42
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Note that according to the disallowed admob implementations:
App load or exit
Do not place interstitial ads on app load and when exiting apps as interstitials should only be placed in between pages of app content.
Failure to adhere to this policy might lead to the disabling of ad-serving to your app.
If you still want this, you can display in your onResume's
method:
boolean isAdShown;
@Override
protected void onResume() {
super.onResume();
if (!isAdShown) {
displayInterstitial();
isAdShown = true;
}
}
No I don't want this Give me an allowed method . please
– Silent Joker
Aug 26 '15 at 15:14
So you mean I should use onPause() method . ok then just show me with codes
– Silent Joker
Aug 26 '15 at 16:29
add a comment |
up vote
1
down vote
Note that according to the disallowed admob implementations:
App load or exit
Do not place interstitial ads on app load and when exiting apps as interstitials should only be placed in between pages of app content.
Failure to adhere to this policy might lead to the disabling of ad-serving to your app.
If you still want this, you can display in your onResume's
method:
boolean isAdShown;
@Override
protected void onResume() {
super.onResume();
if (!isAdShown) {
displayInterstitial();
isAdShown = true;
}
}
No I don't want this Give me an allowed method . please
– Silent Joker
Aug 26 '15 at 15:14
So you mean I should use onPause() method . ok then just show me with codes
– Silent Joker
Aug 26 '15 at 16:29
add a comment |
up vote
1
down vote
up vote
1
down vote
Note that according to the disallowed admob implementations:
App load or exit
Do not place interstitial ads on app load and when exiting apps as interstitials should only be placed in between pages of app content.
Failure to adhere to this policy might lead to the disabling of ad-serving to your app.
If you still want this, you can display in your onResume's
method:
boolean isAdShown;
@Override
protected void onResume() {
super.onResume();
if (!isAdShown) {
displayInterstitial();
isAdShown = true;
}
}
Note that according to the disallowed admob implementations:
App load or exit
Do not place interstitial ads on app load and when exiting apps as interstitials should only be placed in between pages of app content.
Failure to adhere to this policy might lead to the disabling of ad-serving to your app.
If you still want this, you can display in your onResume's
method:
boolean isAdShown;
@Override
protected void onResume() {
super.onResume();
if (!isAdShown) {
displayInterstitial();
isAdShown = true;
}
}
edited Aug 26 '15 at 7:45
Jared Rummler
28.7k1392119
28.7k1392119
answered Aug 26 '15 at 7:30
Nana Ghartey
6,97811825
6,97811825
No I don't want this Give me an allowed method . please
– Silent Joker
Aug 26 '15 at 15:14
So you mean I should use onPause() method . ok then just show me with codes
– Silent Joker
Aug 26 '15 at 16:29
add a comment |
No I don't want this Give me an allowed method . please
– Silent Joker
Aug 26 '15 at 15:14
So you mean I should use onPause() method . ok then just show me with codes
– Silent Joker
Aug 26 '15 at 16:29
No I don't want this Give me an allowed method . please
– Silent Joker
Aug 26 '15 at 15:14
No I don't want this Give me an allowed method . please
– Silent Joker
Aug 26 '15 at 15:14
So you mean I should use onPause() method . ok then just show me with codes
– Silent Joker
Aug 26 '15 at 16:29
So you mean I should use onPause() method . ok then just show me with codes
– Silent Joker
Aug 26 '15 at 16:29
add a comment |
up vote
-1
down vote
You should not place interstitial ads on app load and when exiting apps as However. You can show Interstitial after app load, with such practice you have to implement a splash screen in your app and show interstitial after it.
An interstitial ad launches while the user is idle on the ‘Home
Screen’ of the app. This implementation is in violation of our
policies . One potential way to fix this violation, would be to
implement a splash page that launches as the first screen of the app,
before the ‘Home Screen’. The Interstitial ad should then launch in
the transition between the splash screen and the ‘Home Screen’.
Reference : -- > Google Blog
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Eray Balkanli
Nov 8 at 14:28
Couldn't agree more, just updated the answer, Thanks
– Aegon
Nov 8 at 20:42
add a comment |
up vote
-1
down vote
You should not place interstitial ads on app load and when exiting apps as However. You can show Interstitial after app load, with such practice you have to implement a splash screen in your app and show interstitial after it.
An interstitial ad launches while the user is idle on the ‘Home
Screen’ of the app. This implementation is in violation of our
policies . One potential way to fix this violation, would be to
implement a splash page that launches as the first screen of the app,
before the ‘Home Screen’. The Interstitial ad should then launch in
the transition between the splash screen and the ‘Home Screen’.
Reference : -- > Google Blog
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Eray Balkanli
Nov 8 at 14:28
Couldn't agree more, just updated the answer, Thanks
– Aegon
Nov 8 at 20:42
add a comment |
up vote
-1
down vote
up vote
-1
down vote
You should not place interstitial ads on app load and when exiting apps as However. You can show Interstitial after app load, with such practice you have to implement a splash screen in your app and show interstitial after it.
An interstitial ad launches while the user is idle on the ‘Home
Screen’ of the app. This implementation is in violation of our
policies . One potential way to fix this violation, would be to
implement a splash page that launches as the first screen of the app,
before the ‘Home Screen’. The Interstitial ad should then launch in
the transition between the splash screen and the ‘Home Screen’.
Reference : -- > Google Blog
You should not place interstitial ads on app load and when exiting apps as However. You can show Interstitial after app load, with such practice you have to implement a splash screen in your app and show interstitial after it.
An interstitial ad launches while the user is idle on the ‘Home
Screen’ of the app. This implementation is in violation of our
policies . One potential way to fix this violation, would be to
implement a splash page that launches as the first screen of the app,
before the ‘Home Screen’. The Interstitial ad should then launch in
the transition between the splash screen and the ‘Home Screen’.
Reference : -- > Google Blog
edited Nov 10 at 16:46
answered Nov 8 at 13:38
Aegon
393
393
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Eray Balkanli
Nov 8 at 14:28
Couldn't agree more, just updated the answer, Thanks
– Aegon
Nov 8 at 20:42
add a comment |
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Eray Balkanli
Nov 8 at 14:28
Couldn't agree more, just updated the answer, Thanks
– Aegon
Nov 8 at 20:42
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Eray Balkanli
Nov 8 at 14:28
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Eray Balkanli
Nov 8 at 14:28
Couldn't agree more, just updated the answer, Thanks
– Aegon
Nov 8 at 20:42
Couldn't agree more, just updated the answer, Thanks
– Aegon
Nov 8 at 20:42
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32208974%2fhow-to-show-admob-interstitial-on-app-start%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown