Example #1
0
  public int s3eKiipSaveMomentWithValue(String momentID, double value) {
    final MainActivity activity = (MainActivity) LoaderAPI.getActivity();
    Kiip kiip = Kiip.getInstance();

    final String m = momentID;
    final double v = value;

    kiip.saveMoment(
        m,
        v,
        new Kiip.Callback() {
          @Override
          public void onFailed(Kiip kiip, Exception exception) {
            Log.e(TAG, "Failed to save moment " + m + " value " + v, exception);
            MainActivity.native_saveMomentCompletion(exception.toString());
            // activity.onException(exception);
          }

          @Override
          public void onFinished(Kiip kiip, Poptart poptart) {
            Log.d(TAG, "Moment saved poptart=" + poptart);
            activity.onPoptart(poptart);
            MainActivity.native_saveMomentCompletion(null);
          }
        });

    return 0;
  }
Example #2
0
  public void s3eKiipSetBirthday(String dob) {
    Log.d(TAG, "SetBirthday");
    Kiip kiip = Kiip.getInstance();

    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    Date date = df.parse(dob, new ParsePosition(0));

    kiip.setBirthday(date);
  }
Example #3
0
  public void onStop(Context context) {
    // Must call endSession in every Activity#onStop.
    debugLog("onStop.");
    Kiip.getInstance()
        .endSession(
            new Kiip.Callback() {
              @Override
              public void onFailed(Kiip kiip, Exception exception) {
                debugLog("onStop: Failed to end session: " + exception + ".");
                if (mListener != null) {
                  mListener.onEndSession(KiipHelper.this, exception);
                }
              }

              @Override
              public void onFinished(Kiip kiip, Poptart poptart) {
                debugLog("onStop: Ended session.");
                if (kiip != null && mListener != null) {
                  mListener.onEndSession(KiipHelper.this, null);
                }
              }
            });
  }
Example #4
0
  public void onStart(Context context) {
    // Must call startSession in every Activity#onStart.
    debugLog("onStart.");
    Kiip.getInstance()
        .startSession(
            new Kiip.Callback() {
              @Override
              public void onFailed(Kiip kiip, Exception exception) {
                debugLog("onStart: Failed to start session: " + exception + ".");
                if (mListener != null) {
                  mListener.onStartSession(KiipHelper.this, null, exception);
                }
              }

              @Override
              public void onFinished(Kiip kiip, Poptart poptart) {
                debugLog("onStart: Started session.");
                if (kiip != null && mListener != null) {
                  mListener.onStartSession(KiipHelper.this, poptart, null);
                }
                getKiipFragment().showPoptart(poptart);
              }
            });
  }
Example #5
0
 public void s3eKiipSetGender(String gender) {
   Log.d(TAG, "SetGender");
   Kiip kiip = Kiip.getInstance();
   kiip.setGender(gender);
 }
Example #6
0
 public void s3eKiipSetAlias(String alias) {
   Log.d(TAG, "SetAlias");
   Kiip kiip = Kiip.getInstance();
   kiip.setAlias(alias);
 }
Example #7
0
 public void s3eKiipSetEmailAddress(String email) {
   Log.d(TAG, "SetEmailAddress");
   Kiip kiip = Kiip.getInstance();
   kiip.setEmail(email);
 }