@Override
  public void onUnclaimedAchievement(SessionM sessionM, AchievementData achievementData) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
      Log.d(TAG, this + ".onUnclaimedAchievement: " + achievementData);
    }

    if (callbackGameObjectName != null) {
      UnityPlayer.UnitySendMessage(
          callbackGameObjectName,
          "_sessionM_HandleUnclaimedAchievementMessage",
          achievementData.toString());
    }
  }
 // Return achievement data as JSON for unity
 public static String getAchievementJSON(AchievementData achievement) {
   JSONObject jsonObject = new JSONObject();
   SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
   Date earnedDate;
   Date startDate;
   long time = 0;
   String date = achievement.lastEarnedDate();
   if (date != null && !date.equals("null")) {
     try {
       startDate = formatter.parse("00010101");
       earnedDate = formatter.parse(date);
       time = (earnedDate.getTime() - startDate.getTime()) * 10000;
     } catch (ParseException e) {
       if (Log.isLoggable(TAG, Log.DEBUG)) {
         Log.d(TAG, "ParseException when trying to get achievement last earn date: " + e);
       }
     }
   }
   try {
     jsonObject.put("name", (achievement.getName() == null) ? "" : achievement.getName());
     jsonObject.put("message", (achievement.getMessage() == null) ? "" : achievement.getMessage());
     jsonObject.put("mpointValue", achievement.getMpointValue());
     jsonObject.put(
         "identifier",
         (achievement.getAchievementId() == null) ? "" : achievement.getAchievementId());
     jsonObject.put("isCustom", achievement.isCustom());
     jsonObject.put(
         "importID", (achievement.getImportId() == null) ? "" : achievement.getImportId());
     jsonObject.put(
         "instructions",
         (achievement.getInstructions() == null) ? "" : achievement.getInstructions());
     jsonObject.put(
         "achievementIconURL",
         (achievement.getAchievementIconURL() == null) ? "" : achievement.getAchievementIconURL());
     jsonObject.put("action", (achievement.getAction() == null) ? "" : achievement.getAction());
     jsonObject.put(
         "limitText", (achievement.getLimitTimes() == null) ? "" : achievement.getLimitTimes());
     jsonObject.put("timesEarned", achievement.getTimesEarned());
     jsonObject.put("unclaimedCount", achievement.getUnclaimedCount());
     jsonObject.put("distance", achievement.getDistance());
     jsonObject.put("lastEarnedDate", time);
   } catch (JSONException e) {
     if (Log.isLoggable(TAG, Log.DEBUG)) {
       Log.d(TAG, "JSONException when trying to get achievement json: " + e);
     }
   }
   return jsonObject.toString();
 }