public static void launchScoreDialog(final Context context, final String score, final String displayScore, final String levelId, final Drawable gameIcon,
            final String gamePackage, final boolean fromSdk, final boolean skipModalDialog) {
        final Float scoreF = Float.parseFloat(score);

        final SharedPreferences scoresPrefs = context.getSharedPreferences(SCORES, 0);
        final SharedPreferences displayScoresPrefs = context.getSharedPreferences(DISPLAY_SCORES, 0);
        final SharedPreferences orderPrefs = context.getSharedPreferences(ORDER, 0);

        if (scoresPrefs.contains(levelId) && orderPrefs.contains(levelId)) {
            // Determine which dialog to show without doing the request
            Float personalBest = scoresPrefs.getFloat(levelId, 0.0f);
            String personalBestDisplay = displayScoresPrefs.getString(levelId, "");
            boolean lowestScoreFirst = orderPrefs.getBoolean(levelId, false);
            boolean newBest;

            if (lowestScoreFirst) {
                newBest = scoreF < personalBest;
            } else {
                newBest = scoreF > personalBest;
            }

            if (newBest) {
                saveLeaderboardInfoOnPhone(context, scoreF, displayScore, levelId, null, true);
                personalBestDisplay = displayScore;
            }

            if (newBest && !skipModalDialog) {
                // Show full dialog immediately, and the dialog will make the request to save it and get leaderboard
                LeaderboardScoreDialogFull d = new LeaderboardScoreDialogFull(context, null, gamePackage, score, displayScore, levelId);
                d.setFromSdk(fromSdk);
                d.show();
            } else {
                // Show top dialog immediately, and make the request to save it in the background
                LeaderboardScoreDialogTop d = new LeaderboardScoreDialogTop(context, null, gamePackage, score, displayScore, levelId, personalBestDisplay,
                        gameIcon);
                if (newBest && skipModalDialog) {
                    d.setPersonalBest(true);
                }
                d.setFromSdk(fromSdk);
                d.show();
            }
        } else {
            // Immediately show personal best dialog (technically, their device may have a better score on the server, e.g. if they cleared their shared prefs,
            // but that should be rare).
            // The dialog will post this score in the background and fetch and save the true personal best.
            saveLeaderboardInfoOnPhone(context, scoreF, displayScore, levelId, null, true);
            
            if (skipModalDialog) {
                LeaderboardScoreDialogTop d = new LeaderboardScoreDialogTop(context, null, gamePackage, score, displayScore, levelId, displayScore, gameIcon);
                d.setPersonalBest(true);
                d.setFromSdk(fromSdk);
                d.show();
            } else {
                LeaderboardScoreDialogFull d = new LeaderboardScoreDialogFull(context, null, gamePackage, score, displayScore, levelId);
                d.setFromSdk(fromSdk);
                d.show();
            }
        }

    }