/** Shows GameCenter standard interface for Achievements */
  public void showAchievementsView() {
    // If player is not authenticated, do nothing
    if (!GKLocalPlayer.getLocalPlayer().isAuthenticated()) {
      return;
    }

    // If iOS version is 6 or more we use the new method
    if (getIosVersion() >= IOS_6) {
      GKGameCenterViewController gameCenterView = new GKGameCenterViewController();
      gameCenterView.setGameCenterDelegate(
          new GKGameCenterControllerDelegate.Adapter() {
            @Override
            public void gameCenterViewControllerDidFinish(
                GKGameCenterViewController gameCenterViewController) {
              gameCenterViewController.dismissViewController(true, null);
            }
          });
      gameCenterView.setViewState(
          GKGameCenterViewControllerState.GKGameCenterViewControllerStateAchievements);
      keyWindow.getRootViewController().presentViewController(gameCenterView, true, null);
    } else { // If iOS version is 6 or less we use the deprecated method
      GKAchievementViewController gameCenterView = new GKAchievementViewController();
      gameCenterView.setAchievementDelegate(
          new GKAchievementViewControllerDelegate.Adapter() {
            @Override
            public void achievementViewControllerDidFinish(
                GKAchievementViewController viewController) {
              viewController.dismissViewController(true, null);
            }
          });
      keyWindow.getRootViewController().presentViewController(gameCenterView, true, null);
    }
  }
  /**
   * Shows GameCenter standard interface for one Leaderboard
   *
   * @param identifier
   */
  public void showLeaderboardView(String identifier) {
    // If player is not authenticated, do nothing
    if (!GKLocalPlayer.getLocalPlayer().isAuthenticated()) {
      return;
    }

    // If iOS version is 6 or more we use the new method
    if (getIosVersion() >= IOS_6) {
      GKGameCenterViewController gameCenterView = new GKGameCenterViewController();
      gameCenterView.setGameCenterDelegate(
          new GKGameCenterControllerDelegate.Adapter() {
            @Override
            public void gameCenterViewControllerDidFinish(
                GKGameCenterViewController gameCenterViewController) {
              gameCenterViewController.dismissViewController(true, null);
            }
          });
      gameCenterView.setViewState(
          GKGameCenterViewControllerState.GKGameCenterViewControllerStateLeaderboards);
      gameCenterView.setLeaderboardTimeScope(GKLeaderboardTimeScope.GKLeaderboardTimeScopeAllTime);
      if (getIosVersion() >= IOS_7) gameCenterView.setLeaderboardIdentifier(identifier);
      else gameCenterView.setLeaderboardCategory(identifier);

      keyWindow.getRootViewController().presentViewController(gameCenterView, true, null);
    } else { // If iOS version is 6 or less we use the deprecated method
      GKLeaderboardViewController gameCenterView = new GKLeaderboardViewController();
      gameCenterView.setCategory(identifier);
      gameCenterView.setTimeScope(GKLeaderboardTimeScope.GKLeaderboardTimeScopeAllTime);
      gameCenterView.setLeaderboardDelegate(
          new GKLeaderboardViewControllerDelegate.Adapter() {
            @Override
            public void leaderboardViewControllerDidFinish(
                GKLeaderboardViewController viewController) {
              viewController.dismissViewController(true, null);
            }
          });

      keyWindow.getRootViewController().presentViewController(gameCenterView, true, null);
    }
  }