Android Open Source - ABTester A B Events Shared Prefs






From Project

Back to project page ABTester.

License

The source code is released under:

MIT License

If you think the Android project ABTester listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ab.tester.prefs;
/*w  w  w.ja  v a 2 s .co m*/
import android.content.Context;
import android.content.SharedPreferences;

public class ABEventsSharedPrefs extends ABSharedPrefs {

  private static final String EVENT_SENT_KEY = "EVENT_SENT___";
  
  public ABEventsSharedPrefs(Context context) {
    super(context);
  }

  @Override
  protected String getPrefsName() {
    return "ABTester_experiments_values_events";
  }

  public boolean wasEventReported(String eventName) {
    return prefs.getBoolean(EVENT_SENT_KEY + eventName, false);
  }
  
  public void reportEvent(String eventName) {
    SharedPreferences.Editor editor = prefs.edit();
    editor.putBoolean(EVENT_SENT_KEY + eventName, true);
    apply(editor);
  }

}




Java Source Code List

ab.tester.ABTest.java
ab.tester.ABTester.java
ab.tester.DefualtLogger.java
ab.tester.LoggerInterface.java
ab.tester.prefs.ABEventsSharedPrefs.java
ab.tester.prefs.ABGeneralSharedPrefs.java
ab.tester.prefs.ABSharedPrefs.java
ab.tester.prefs.ABTestsSharedPrefs.java
com.example.ab_sample.MainActivity.java
com.example.ab_sample.SplashActivity.java