I need an ad screen(revmob) to show once daily when called from the onCreate method. I grabbed the idea from How do I get an Android application's method to run a method daily with Eclipse? but it is not working since the ad is loading every time the onCreate is called.
The code I have is:
if(runOnceDaily()){
revmob = RevMob.start(this, REVMOB_APP_ID);
revmob.showFullscreen(this);
}
private boolean runOnceDaily(){
boolean result = false;
SharedPreferences prefs = this.getSharedPreferences(
"com.blogspot.blog.myapp", Context.MODE_PRIVATE);
long minStartTime = System.currentTimeMillis() - 1000*60*60*24;
long lastTimeRan = prefs.getLong("lastTimeRan", -1);
if (lastTimeRan >= minStartTime) {
// a day passed.
//also save the new 'lastTimeRan' in prefs
result = true;
prefs.edit().putLong("lastTimeRan", System.currentTimeMillis()).commit();
}
return result;
}