Example usage for android.net Uri getSchemeSpecificPart

List of usage examples for android.net Uri getSchemeSpecificPart

Introduction

In this page you can find the example usage for android.net Uri getSchemeSpecificPart.

Prototype

public abstract String getSchemeSpecificPart();

Source Link

Document

Gets the scheme-specific part of this URI, i.e. everything between the scheme separator ':' and the fragment separator '#'.

Usage

From source file:com.tinfoil.sms.sms.SendMessageActivity.java

private void handleSendIntent() {
    Intent intent = this.getIntent();

    //Toast.makeText(this, ""+(Intent.ACTION_SENDTO.equals(intent.getAction())&& intent.getType() != null), Toast.LENGTH_LONG).show();

    if (Intent.ACTION_SEND.equals(intent.getAction()) && intent.getType() != null) {

        if ("text/plain".equals(intent.getType())) {

            String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);

            if (sharedText != null) {
                setupComposeView(null, sharedText);
            }/*from   ww w  .ja va 2s  . com*/
        }
    } else if (Intent.ACTION_SENDTO.equals(intent.getAction())) {

        String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
        Uri uri = this.getIntent().getData();

        if (uri.getSchemeSpecificPart() != null) {

            String number = uri.getSchemeSpecificPart();

            if (dba.inDatabase(number)) {
                setupMessageView(SMSUtility.format(number), sharedText);
            } else {
                setupComposeView(SMSUtility.format(number), sharedText);
            }
        }
    }
}

From source file:org.rebo.app.TileMap.java

private void handleIntent(Intent intent, boolean start) {
    if (intent == null)
        return;//from w w w . j  a  va 2s . c o m

    Uri uri = intent.getData();
    if (uri != null) {
        String scheme = uri.getSchemeSpecificPart();
        log.debug("got intent: " + (scheme == null ? "" : scheme));
    }
}

From source file:com.android.packageinstaller.PackageInstallerActivity.java

private void processPackageUri(final Uri packageUri) {
    mPackageURI = packageUri;//from   ww w.  ja v  a 2  s  .  c o  m

    final String scheme = packageUri.getScheme();
    final PackageUtil.AppSnippet as;

    switch (scheme) {
    case SCHEME_PACKAGE: {
        try {
            mPkgInfo = mPm.getPackageInfo(packageUri.getSchemeSpecificPart(),
                    PackageManager.GET_PERMISSIONS | PackageManager.GET_UNINSTALLED_PACKAGES);
        } catch (NameNotFoundException e) {
        }
        if (mPkgInfo == null) {
            Log.w(TAG, "Requested package " + packageUri.getScheme()
                    + " not available. Discontinuing installation");
            showDialogInner(DLG_PACKAGE_ERROR);
            setPmResult(PackageManager.INSTALL_FAILED_INVALID_APK);
            return;
        }
        as = new PackageUtil.AppSnippet(mPm.getApplicationLabel(mPkgInfo.applicationInfo),
                mPm.getApplicationIcon(mPkgInfo.applicationInfo));
    }
        break;

    case SCHEME_FILE: {
        File sourceFile = new File(packageUri.getPath());
        PackageParser.Package parsed = PackageUtil.getPackageInfo(sourceFile);

        // Check for parse errors
        if (parsed == null) {
            Log.w(TAG, "Parse error when parsing manifest. Discontinuing installation");
            showDialogInner(DLG_PACKAGE_ERROR);
            setPmResult(PackageManager.INSTALL_FAILED_INVALID_APK);
            return;
        }
        mPkgInfo = PackageParser.generatePackageInfo(parsed, null, PackageManager.GET_PERMISSIONS, 0, 0, null,
                new PackageUserState());
        as = PackageUtil.getAppSnippet(this, mPkgInfo.applicationInfo, sourceFile);
    }
        break;

    case SCHEME_CONTENT: {
        mStagingAsynTask = new StagingAsyncTask();
        mStagingAsynTask.execute(packageUri);
        return;
    }

    default: {
        Log.w(TAG, "Unsupported scheme " + scheme);
        setPmResult(PackageManager.INSTALL_FAILED_INVALID_URI);
        clearCachedApkIfNeededAndFinish();
        return;
    }
    }

    PackageUtil.initSnippetForNewApp(this, as, R.id.app_snippet);

    initiateInstall();
}

From source file:com.baroq.pico.google.PlayServices.java

@Override
public void onPlayersLoaded(int statusCode, PlayerBuffer buffer) {
    JSONObject json = new JSONObject();
    try {// w ww. j av a  2 s.  c o m
        json.put("type", PLAYER_LOADED);
        json.put("statusCode", statusCode);
        switch (statusCode) {
        case GamesClient.STATUS_OK:
            // if data was successfully loaded and is up-to-date.
            JSONArray players = new JSONArray();
            JSONObject player;
            for (int i = 0, l = buffer.getCount(); i < l; i++) {
                Player p = buffer.get(i);
                player = new JSONObject();
                player.put("displayName", p.getDisplayName());
                if (p.hasHiResImage()) {
                    Uri uri = p.getHiResImageUri();
                    player.put("hiResImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                }
                if (p.hasIconImage()) {
                    Uri uri = p.getIconImageUri();
                    player.put("iconImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                }
                player.put("playerId", p.getPlayerId());
                player.put("retrievedTimestamp", p.getRetrievedTimestamp());
                players.put(player);
            }
            json.put("list", players);
            break;
        case GamesClient.STATUS_INTERNAL_ERROR:
            // if an unexpected error occurred in the service 
            break;
        case GamesClient.STATUS_NETWORK_ERROR_STALE_DATA:
            // if the device was unable to communicate with the network. In this case, the operation is not retried automatically.
            break;
        case GamesClient.STATUS_CLIENT_RECONNECT_REQUIRED:
            // need to reconnect GamesClient
            mHelper.reconnectClients(clientTypes);
            break;
        case GamesClient.STATUS_LICENSE_CHECK_FAILED:
            // The game is not licensed to the user. Further calls will return the same code.
            break;
        default:
            // error
            break;
        }
    } catch (JSONException ex) {
        Log.e(TAG, "PLAYER_LOADED [" + statusCode + "] exception: " + ex.getMessage());
        return;
    }

    buffer.close();
    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
    pluginResult.setKeepCallback(true);
    connectionCB.sendPluginResult(pluginResult);
}

From source file:org.mozilla.gecko.GeckoAppShell.java

public static void showAlertNotification(String aImageUrl, String aAlertTitle, String aAlertText,
        String aAlertCookie, String aAlertName) {
    Log.i(LOGTAG,//from   w  ww  .  j a va2  s .  c o  m
            "GeckoAppShell.showAlertNotification\n" + "- image = '" + aImageUrl + "'\n" + "- title = '"
                    + aAlertTitle + "'\n" + "- text = '" + aAlertText + "'\n" + "- cookie = '" + aAlertCookie
                    + "'\n" + "- name = '" + aAlertName + "'");

    int icon = R.drawable.icon; // Just use the app icon by default

    Uri imageUri = Uri.parse(aImageUrl);
    String scheme = imageUri.getScheme();
    if ("drawable".equals(scheme)) {
        String resource = imageUri.getSchemeSpecificPart();
        resource = resource.substring(resource.lastIndexOf('/') + 1);
        try {
            Class<R.drawable> drawableClass = R.drawable.class;
            Field f = drawableClass.getField(resource);
            icon = f.getInt(null);
        } catch (Exception e) {
        } // just means the resource doesn't exist
        imageUri = null;
    }

    int notificationID = aAlertName.hashCode();

    // Remove the old notification with the same ID, if any
    removeNotification(notificationID);

    AlertNotification notification = new AlertNotification(GeckoApp.mAppContext, notificationID, icon,
            aAlertTitle, aAlertText, System.currentTimeMillis());

    // The intent to launch when the user clicks the expanded notification
    Intent notificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLICK);
    notificationIntent.setClassName(GeckoApp.mAppContext,
            GeckoApp.mAppContext.getPackageName() + ".NotificationHandler");

    // Put the strings into the intent as an URI "alert:<name>#<cookie>"
    Uri dataUri = Uri.fromParts("alert", aAlertName, aAlertCookie);
    notificationIntent.setData(dataUri);

    PendingIntent contentIntent = PendingIntent.getBroadcast(GeckoApp.mAppContext, 0, notificationIntent, 0);
    notification.setLatestEventInfo(GeckoApp.mAppContext, aAlertTitle, aAlertText, contentIntent);
    notification.setCustomIcon(imageUri);
    // The intent to execute when the status entry is deleted by the user with the "Clear All Notifications" button
    Intent clearNotificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLEAR);
    clearNotificationIntent.setClassName(GeckoApp.mAppContext,
            GeckoApp.mAppContext.getPackageName() + ".NotificationHandler");
    clearNotificationIntent.setData(dataUri);
    notification.deleteIntent = PendingIntent.getBroadcast(GeckoApp.mAppContext, 0, clearNotificationIntent, 0);

    mAlertNotifications.put(notificationID, notification);

    notification.show();

    Log.i(LOGTAG, "Created notification ID " + notificationID);
}

From source file:com.baroq.pico.google.PlayServices.java

@Override
public void onGamesLoaded(int statusCode, GameBuffer buffer) {
    JSONObject json = new JSONObject();
    try {//from   w w w.  ja v a  2 s .c o m
        json.put("type", GAMES_LOADED);
        json.put("statusCode", statusCode);
        switch (statusCode) {
        case GamesClient.STATUS_OK:
            // if data was successfully loaded and is up-to-date.
            JSONArray games = new JSONArray();
            JSONObject game;
            for (int i = 0, l = buffer.getCount(); i < l; i++) {
                Game g = buffer.get(i);
                game = new JSONObject();
                game.put("achievementTotalCount", g.getAchievementTotalCount());
                game.put("applicationId", g.getApplicationId());
                game.put("description", g.getDescription());
                game.put("developerName", g.getDeveloperName());
                game.put("displayName", g.getDisplayName());
                Uri uri = g.getFeaturedImageUri();
                if (null != uri)
                    game.put("featuredImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                uri = g.getHiResImageUri();
                if (null != uri)
                    game.put("hiResImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                uri = g.getIconImageUri();
                if (null != uri)
                    game.put("iconImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                game.put("leaderboardCount", g.getLeaderboardCount());
                game.put("primaryCategory", g.getPrimaryCategory());
                game.put("secondaryCategory", g.getSecondaryCategory());
                games.put(game);
            }
            json.put("list", games);
            break;
        case GamesClient.STATUS_INTERNAL_ERROR:
            // if an unexpected error occurred in the service 
            break;
        case GamesClient.STATUS_NETWORK_ERROR_STALE_DATA:
            // if the device was unable to communicate with the network. In this case, the operation is not retried automatically.
            break;
        case GamesClient.STATUS_CLIENT_RECONNECT_REQUIRED:
            // need to reconnect GamesClient
            mHelper.reconnectClients(clientTypes);
            break;
        case GamesClient.STATUS_LICENSE_CHECK_FAILED:
            // The game is not licensed to the user. Further calls will return the same code.
            break;
        default:
            // error
            break;
        }
    } catch (JSONException ex) {
        Log.e(TAG, "GAMES_LOADED [" + statusCode + "] exception: " + ex.getMessage());
        return;
    }

    buffer.close();
    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
    pluginResult.setKeepCallback(true);
    connectionCB.sendPluginResult(pluginResult);
}

From source file:com.baroq.pico.google.PlayServices.java

@Override
public void onLeaderboardMetadataLoaded(int statusCode, LeaderboardBuffer leaderboard) {
    JSONObject json = new JSONObject();
    try {//from  w w w. jav a 2s . c o  m
        json.put("type", GAME_LEADERBOARD_METADATA_LOADED);
        json.put("statusCode", statusCode);
        switch (statusCode) {
        case GamesClient.STATUS_OK:
            // if data was successfully loaded and is up-to-date.
            JSONArray list = new JSONArray();
            JSONObject obj;
            JSONArray vList;
            JSONObject v;
            Leaderboard lb;
            ArrayList<LeaderboardVariant> variants;
            LeaderboardVariant variant;
            int i, l, j, k;
            for (i = 0, l = leaderboard.getCount(); i < l; i++) {
                obj = new JSONObject();
                lb = leaderboard.get(i);
                obj.put("displayName", lb.getDisplayName());
                Uri uri = lb.getIconImageUri();
                if (null != uri)
                    obj.put("iconImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                obj.put("leaderboardId", lb.getLeaderboardId());
                obj.put("scoreOrder", lb.getScoreOrder());
                variants = lb.getVariants();
                vList = new JSONArray();
                for (j = 0, k = variants.size(); j < k; j++) {
                    v = new JSONObject();
                    variant = variants.get(i);
                    v.put("collection", variant.getCollection());
                    v.put("numScores", variant.getNumScores());
                    v.put("timeSpan", variant.getTimeSpan());
                    v.put("hasPlayerInfo", variant.hasPlayerInfo());
                    if (variant.hasPlayerInfo()) {
                        v.put("displayPlayerRank", variant.getDisplayPlayerRank());
                        v.put("displayPlayerScore", variant.getDisplayPlayerScore());
                        v.put("playerRank", variant.getPlayerRank());
                        v.put("rawPlayerScore", variant.getRawPlayerScore());
                    }
                    vList.put(v);
                    obj.put("variants", vList);
                }
                list.put(obj);
            }
            json.put("leaderboard", list);
            break;
        case GamesClient.STATUS_INTERNAL_ERROR:
            // if an unexpected error occurred in the service 
            break;
        case GamesClient.STATUS_NETWORK_ERROR_STALE_DATA:
            // if the device was unable to communicate with the network. in this case, the operation is not retried automatically.
            break;
        case GamesClient.STATUS_CLIENT_RECONNECT_REQUIRED:
            // need to reconnect GamesClient
            mHelper.reconnectClients(clientTypes);
            break;
        case GamesClient.STATUS_LICENSE_CHECK_FAILED:
            // the game is not licensed to the user. further calls will return the same code.
            break;
        default:
            // error
            break;
        }
    } catch (JSONException ex) {
        Log.e(TAG, "game_leaderboard_scores_loaded [" + statusCode + "] exception: " + ex.getMessage());
        return;
    }

    leaderboard.close();
    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
    pluginResult.setKeepCallback(true);
    connectionCB.sendPluginResult(pluginResult);
}

From source file:com.baroq.pico.google.PlayServices.java

@Override
public void onAchievementsLoaded(int statusCode, AchievementBuffer buffer) {
    JSONObject json = new JSONObject();
    try {/*from  w  w  w.  j  a  va  2  s. c  o  m*/
        json.put("type", GAME_ACHIEVEMENT_LOADED);
        json.put("statusCode", statusCode);
        switch (statusCode) {
        case GamesClient.STATUS_OK:
            // if data was successfully loaded and is up-to-date
            JSONArray achievements = new JSONArray();
            JSONObject achievement;
            Achievement a;
            for (int i = 0, l = buffer.getCount(); i < l; i++) {
                a = buffer.get(i);
                achievement = new JSONObject();
                achievement.put("achievementId", a.getAchievementId());
                achievement.put("description", a.getDescription());
                achievement.put("lastUpdatedTimestamp", a.getLastUpdatedTimestamp());
                achievement.put("name", a.getName());
                achievement.put("achievementId", a.getPlayer().getPlayerId());
                achievement.put("state", a.getState());
                achievement.put("type", a.getType());
                if (Achievement.TYPE_INCREMENTAL == a.getType()) {
                    achievement.put("currentSteps", a.getCurrentSteps());
                    achievement.put("totalSteps", a.getTotalSteps());
                    achievement.put("formattedCurrentSteps", a.getFormattedCurrentSteps());
                    achievement.put("formattedTotalSteps", a.getFormattedTotalSteps());
                }
                Uri uri = a.getRevealedImageUri();
                if (null != uri)
                    achievement.put("revealedImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                uri = a.getUnlockedImageUri();
                if (null != uri)
                    achievement.put("unlockedImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                achievements.put(achievement);
            }
            json.put("list", achievements);
            break;
        case GamesClient.STATUS_NETWORK_ERROR_NO_DATA:
            // A network error occurred while attempting to retrieve fresh data, and no data was available locally.
            break;
        case GamesClient.STATUS_INTERNAL_ERROR:
            // if an unexpected error occurred in the service 
            break;
        case GamesClient.STATUS_NETWORK_ERROR_STALE_DATA:
            // if the device was unable to communicate with the network. In this case, the operation is not retried automatically.
            break;
        case GamesClient.STATUS_CLIENT_RECONNECT_REQUIRED:
            // need to reconnect GamesClient
            mHelper.reconnectClients(clientTypes);
            break;
        case GamesClient.STATUS_LICENSE_CHECK_FAILED:
            // The game is not licensed to the user. Further calls will return the same code.
            break;
        default:
            // error
            break;
        }
    } catch (JSONException ex) {
        Log.e(TAG, "GAME_ACHIEVEMENT_LOADED [" + statusCode + "] exception: " + ex.getMessage());
        return;
    }

    buffer.close();
    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
    pluginResult.setKeepCallback(true);
    connectionCB.sendPluginResult(pluginResult);
}

From source file:com.sonetel.ui.SipHome.java

private void selectTabWithAction(Intent intent) {
    if (intent != null) {
        String callAction = intent.getAction();
        if (!TextUtils.isEmpty(callAction)) {
            ActionBar ab = getSupportActionBar();
            Tab toSelectTab = null;//from  w ww .  java2s. co  m
            Integer toSelectId = null;
            if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER)
                    || callAction.equalsIgnoreCase(Intent.ACTION_DIAL)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_DIALER);
                if (pos != null && pos == 1) {
                    toSelectTab = ab.getTabAt(pos);
                    Uri data = intent.getData();
                    if (data != null && mDialpadFragment != null) {
                        String nbr = data.getSchemeSpecificPart();
                        if (!TextUtils.isEmpty(nbr)) {
                            mDialpadFragment.setTextDialing(true);
                            mDialpadFragment.setTextFieldValue(nbr);
                        }
                    }
                    toSelectId = TAB_ID_DIALER;
                } else if (pos != null && pos == 2) {
                    toSelectTab = ab.getTabAt(pos);
                    Uri data = intent.getData();
                    if (data != null && mDialpadFragment != null) {
                        String nbr = data.getSchemeSpecificPart();
                        if (!TextUtils.isEmpty(nbr)) {
                            mDialpadFragment.setTextDialing(false);
                            mDialpadFragment.setTextFieldValue(nbr);
                        }
                    }
                    toSelectId = TAB_ID_CONTACT;
                }
            }
            /* else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER)
                || callAction.equalsIgnoreCase(Intent.ACTION_DIAL)) {
            Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CONTACT);
            mDialpadFragment.setTextDialing(false);
            if(pos != null) {
                toSelectTab = ab.getTabAt(pos);
                Uri data = intent.getData();
                if(data != null && mDialpadFragment != null) {
                    String nbr = data.getSchemeSpecificPart();
                    if(!TextUtils.isEmpty(nbr)) {
                        mDialpadFragment.setTextDialing(false);
                        mDialpadFragment.setTextFieldValue(nbr);
                    }
                }
                toSelectId = TAB_ID_CONTACT;
            }
             }*/
            else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_CALLLOG)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CALL_LOG);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_CALL_LOG;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_FAVORITES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_FAVORITES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_FAVORITES;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_MESSAGES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_MESSAGES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_MESSAGES;
                }
            }
            if (toSelectTab != null) {
                ab.selectTab(toSelectTab);
                initTabId = toSelectId;
            } else {
                initTabId = null;
            }

        }
    }
}

From source file:com.baroq.pico.google.PlayServices.java

@Override
public void onLeaderboardScoresLoaded(int statusCode, LeaderboardBuffer leaderboard,
        LeaderboardScoreBuffer scores) {
    JSONObject json = new JSONObject();
    try {/*  www .j  a v a2  s. com*/
        json.put("type", GAME_LEADERBOARD_SCORES_LOADED);
        json.put("statusCode", statusCode);
        switch (statusCode) {
        case GamesClient.STATUS_OK:
            // if data was successfully loaded and is up-to-date.
            JSONArray list = new JSONArray();
            JSONObject obj;
            JSONArray vList;
            JSONObject v;
            Leaderboard lb;
            ArrayList<LeaderboardVariant> variants;
            LeaderboardVariant variant;
            int i, l, j, k;
            for (i = 0, l = leaderboard.getCount(); i < l; i++) {
                obj = new JSONObject();
                lb = leaderboard.get(i);
                obj.put("displayName", lb.getDisplayName());
                Uri uri = lb.getIconImageUri();
                if (null != uri)
                    obj.put("iconImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                obj.put("leaderboardId", lb.getLeaderboardId());
                obj.put("scoreOrder", lb.getScoreOrder());
                variants = lb.getVariants();
                vList = new JSONArray();
                for (j = 0, k = variants.size(); j < k; j++) {
                    v = new JSONObject();
                    variant = variants.get(i);
                    v.put("collection", variant.getCollection());
                    v.put("numScores", variant.getNumScores());
                    v.put("timeSpan", variant.getTimeSpan());
                    v.put("hasPlayerInfo", variant.hasPlayerInfo());
                    if (variant.hasPlayerInfo()) {
                        v.put("displayPlayerRank", variant.getDisplayPlayerRank());
                        v.put("displayPlayerScore", variant.getDisplayPlayerScore());
                        v.put("playerRank", variant.getPlayerRank());
                        v.put("rawPlayerScore", variant.getRawPlayerScore());
                    }
                    vList.put(v);
                    obj.put("variants", vList);
                }
                list.put(obj);
            }
            json.put("leaderboard", list);
            LeaderboardScore lbs;
            for (i = 0, l = scores.getCount(); i < l; i++) {
                obj = new JSONObject();
                lbs = scores.get(i);
                obj.put("displayRank", lbs.getDisplayRank());
                obj.put("displayScore", lbs.getDisplayScore());
                obj.put("rank", lbs.getRank());
                obj.put("rawScore", lbs.getRawScore());
                obj.put("scoreHolderPlayerId", lbs.getScoreHolder().getPlayerId());
                obj.put("scoreHolderDisplayName", lbs.getScoreHolderDisplayName());
                Uri uri = lbs.getScoreHolderHiResImageUri();
                if (null != uri)
                    obj.put("scoreHolderHiResImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                uri = lbs.getScoreHolderIconImageUri();
                if (null != uri)
                    obj.put("scoreHolderIconImageUri", uri.getScheme() + ':' + uri.getSchemeSpecificPart());
                obj.put("timestampMillis", lbs.getTimestampMillis());
                list.put(obj);
            }
            json.put("scores", list);
            break;
        case GamesClient.STATUS_INTERNAL_ERROR:
            // if an unexpected error occurred in the service 
            break;
        case GamesClient.STATUS_NETWORK_ERROR_STALE_DATA:
            // if the device was unable to communicate with the network. in this case, the operation is not retried automatically.
            break;
        case GamesClient.STATUS_CLIENT_RECONNECT_REQUIRED:
            // need to reconnect GamesClient
            mHelper.reconnectClients(clientTypes);
            break;
        case GamesClient.STATUS_LICENSE_CHECK_FAILED:
            // the game is not licensed to the user. further calls will return the same code.
            break;
        default:
            // error
            break;
        }
    } catch (JSONException ex) {
        Log.e(TAG, "game_leaderboard_scores_loaded [" + statusCode + "] exception: " + ex.getMessage());
        return;
    }

    leaderboard.close();
    scores.close();
    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
    pluginResult.setKeepCallback(true);
    connectionCB.sendPluginResult(pluginResult);
}