Commit a1b57838 authored by wanglei's avatar wanglei

...

parent 98b90e11
......@@ -52,6 +52,7 @@ class MyApplication : BaseApplication() {
fun initApp(isFirst: Boolean = false) {
if (!isFirst) {
@Suppress("DEPRECATION")
FacebookSdk.sdkInitialize(applicationContext)
// FacebookSdk.setIsDebugEnabled(true)
// FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS)
......
......@@ -4,9 +4,13 @@ import android.content.SharedPreferences;
import android.util.Log;
import com.base.datarecovery.BuildConfig;
import com.base.datarecovery.MyApplication;
import com.base.datarecovery.help.BaseApplication;
import com.base.datarecovery.utils.AppPreferences;
import com.base.datarecovery.utils.EventUtils;
import com.base.datarecovery.utils.LogEx;
import com.facebook.appevents.AppEventsLogger;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
......@@ -145,6 +149,12 @@ public class AdDisplayUtils {
adDisplayCount = 0;
}
adDisplayCount++;
int max = AppPreferences.getInstance().getInt("facebookAdShowEventCount", 3);
if (adClickCount >= max && max != -1) {
AppEventsLogger logger = AppEventsLogger.newLogger(MyApplication.context);
logger.logEvent("ad_show");
AppPreferences.getInstance().put("facebookAdShowEventCount", -1);
}
saveAdDisplayCount();
}
......
......@@ -4,6 +4,8 @@ import android.app.Activity
import android.os.Bundle
import com.base.datarecovery.help.BaseApplication
import com.base.datarecovery.utils.EventUtils
import com.facebook.appevents.AppEventsConstants
import com.facebook.appevents.AppEventsLogger
import com.google.android.gms.ads.AdValue
import com.google.android.gms.ads.OnPaidEventListener
import com.google.android.gms.ads.ResponseInfo
......@@ -99,6 +101,11 @@ object AdmobEvent {
roasbundle.putString(FirebaseAnalytics.Param.CURRENCY, "USD")
Firebase.analytics.logEvent("Total_Ads_Revenue_001", roasbundle)
taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", 0f)//重新清零,开始计算
val logger = AppEventsLogger.newLogger(BaseApplication.context)
val parameters = Bundle()
parameters.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "USD")
logger.logEvent("ad_value", currentTaichiTroasCache.toDouble(), parameters)
} else {
taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", currentTaichiTroasCache)
}
......
......@@ -8,6 +8,8 @@ import com.base.datarecovery.help.BaseApplication
import com.base.datarecovery.utils.EventUtils
import com.base.datarecovery.utils.LogEx
import com.facebook.FacebookSdk
import com.facebook.appevents.AppEventsConstants
import com.facebook.appevents.AppEventsLogger
import com.google.firebase.analytics.FirebaseAnalytics
import org.json.JSONObject
......@@ -111,6 +113,11 @@ object AdMaxEvent {
roasbundle.putString(FirebaseAnalytics.Param.CURRENCY, "USD")///(Required)tROAS事件必须
mFirebaseAnalytics.logEvent("Total_Ads_Revenue_001", roasbundle) // 给Taichi用
taichiSharedPreferencesEditor.putFloat("TaichiTroasCache", 0f)//重新清零,开始计算
val logger = AppEventsLogger.newLogger(BaseApplication.context)
val parameters = Bundle()
parameters.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "USD")
logger.logEvent("ad_value", currentTaichiTroasCache, parameters)
} else {
taichiSharedPreferencesEditor.putFloat(
"TaichiTroasCache",
......
......@@ -21,7 +21,7 @@ object RateStarPop {
if (AppPreferences.getInstance().getBoolean("isRated", false)) {
return
}
if (n > 0 && n % 2 == 0) {
if (n > 0 && n % 3 == 0) {
} else {
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment