예제 #1
0
  /** If the notification is an update. */
  protected boolean isUpdate() {

    if (!options.getDict().has("updatedAt")) return false;

    long now = new Date().getTime();

    long updatedAt = options.getDict().optLong("updatedAt", now);

    return (now - updatedAt) < 1000;
  }
예제 #2
0
  /** Encode options to JSON. */
  public String toString() {
    JSONObject dict = options.getDict();
    JSONObject json = new JSONObject();

    try {
      json = new JSONObject(dict.toString());
    } catch (JSONException e) {
      e.printStackTrace();
    }

    json.remove("updatedAt");
    json.remove("soundUri");
    json.remove("iconUri");

    return json.toString();
  }