onCreate 메소드를 호출 할 때 매일 한 번씩 광고 화면 (revmob)을 표시해야합니다. 나는 How do I get an Android application's method to run a method daily with Eclipse?에서 아이디어를 얻었지만 onCreate가 호출 될 때마다 광고가로드되기 때문에 작동하지 않습니다.메소드를 매일 실행하도록 Android 앱을 얻으려면 어떻게해야합니까?
내가 가진 코드는 다음과 같습니다
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;
}