question

Kostas avatar image
Kostas asked

getAvatarUrl() returning null

As per subject line I am having an issue whereby getAvatarUrl is returning null on a valid player object. getPlayerAlias() actually correctly returns the expected player alias, however getAvatarUrl does not return a valid URL string. Here's the relevant code: // Get other players' data through leaderboard scores mGamesClient.getLeaderboardsClient().getLeaderboards().setCallback( new AGResponseCallback () { @Override public void onComplete(GetLeaderboardsResponse leaderboards_result) { if (leaderboards_result.isError()) { Log.v(TAG, "getLeaderboards ERROR: " + leaderboards_result.getError()); } else { Log.v(TAG, "getLeaderboards OK"); List leaderboards = leaderboards_result.getLeaderboards(); Log.v(TAG, "Leaderboards Size: " + leaderboards.size()); for(Leaderboard ldrb : leaderboards) { Log.v(TAG, "Queing up a getScores request for leaderboard: " + ldrb.getName()); mGamesClient.getLeaderboardsClient().getScores(ldrb.getId(), LeaderboardFilter.GLOBAL_ALL_TIME).setCallback( new AGResponseCallback () { @Override public void onComplete(GetScoresResponse scores_result) { if (scores_result.isError()) { Log.v(TAG, "getScores ERROR: " + scores_result.getError()); } else { //getLeaderboard() does not seem to actually work on a GetScoresResponse (despite what the API documentation suggests, so line below has to be commented out //Log.v(TAG, "getScores for leaderboard: " + scores_result.getLeaderboard().getName() + " SUCCESSFUL!"); Log.v(TAG, "getScores OK "); List scores = scores_result.getScores(); Log.v(TAG, "Scores Size: " + scores.size()); if(scores.size() > 0) { Log.v(TAG, "Getting player data from leaderboard: " + scores.get(0).getLeaderboard()); } for(Score s : scores) { Player p = s.getPlayer(); if(p != null) { Log.d(TAG, "Got Score for Player: " + p.getAlias()); // Grab name final String player_id = p.getPlayerId(); if(PlayerNames.get(player_id) == null) { Log.v(TAG, "Adding Player Name: " + p.getAlias()); PlayerNames.put(player_id, p.getAlias()); } // Grab image if(PlayerPhotos.get(player_id) == null) { Log.d(TAG, "Adding photo:" + p.getAvatarUrl() + " for player: " + p.getAlias()); // <- p.getAvatarUrl() returns null here - p.getAlias() returns a valid player alias however if(p.getAvatarUrl() != null) { new DownloadAndAddPlayerImageTask(PlayerPhotos, player_id).execute(p.getAvatarUrl()); } } } } } } }); } } } }); [b][/b][b][/b][b][/b][b][/b][b][/b][b][/b]
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Kostas, We have doubled checked that getAvatarUrl() works with latest SDK. AGResponseHandle getScoresResponse = AmazonGamesClient.getInstance().getLeaderboardsClient().getScores(LEADERBOARD_ID, LeaderboardFilter.GLOBAL_ALL_TIME); getScoresResponse.setCallback(new AGResponseCallback () { @Override public void onComplete(GetScoresResponse getScoresResponse) { List scores = getScoresResponse.getScores(); System.out.println("scores = " + scores); for (Score score : scores) { System.out.println("score.getScoreValue() = " + score.getScoreValue()); System.out.println("score.getPlayer().getPlayerId() = " + score.getPlayer().getPlayerId()); System.out.println("score.getPlayer().getAlias() = " + score.getPlayer().getAlias()); System.out.println("score.getPlayer().getAvatarUrl() = " + score.getPlayer().getAvatarUrl()); System.out.println("score.getLeaderboard() = " + score.getLeaderboard()); } } }); 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getScoreValue() = 16 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getPlayer().getPlayerId() = 2ed1799b-a7d7-45e8-b9fc-6760ad98b6c3 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getPlayer().getAlias() = Blrcracker 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getPlayer().getAvatarUrl() = https://images-na.ssl-images-amazon.com/images/I/61P32f-4vSL._AA114_.png 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getLeaderboard() = 16 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getScoreValue() = 14 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getPlayer().getPlayerId() = 5aa62ea1-0621-49c1-bc5b-d35635d6e3ca 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getPlayer().getAlias() = sujoy.ghosh 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getPlayer().getAvatarUrl() = https://images-na.ssl-images-amazon.com/images/I/71u9iBC4k9L._AA114_.png 06-24 02:07:18.148 7341-7341/com.example.leaderboardtest I/System.out﹕ score.getLeaderboard() = 14 I am sending you the sample app, source code and my default debug.keystore to your registered email id so that you also can build back the app and check on your end. You have to make this project dependent on "GameCircleSDK" module (in your IDE) that is shipped with SDK zip. If this does not solve your problem, please file a ContactUs ( https://developer.amazon.com/help/contactus.html) with details of your app and GameCircle configuration.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.