/** * Gets Google maps of a user. * * @param context used to get maps * @param mapsClient the client to access Google Maps * @return true means set successfully */ private static ArrayList<MapsMapMetadata> getMaps(Context context, MapsClient mapsClient) { String authToken = null; ArrayList<String> mapIds = new ArrayList<String>(); ArrayList<MapsMapMetadata> mapData = new ArrayList<MapsMapMetadata>(); try { authToken = AccountManager.get(context) .blockingGetAuthToken(getAccount(context), MapsConstants.SERVICE_NAME, false); } catch (Exception e) { Log.d(EndToEndTestUtils.LOG_TAG, "Unable to get auth token", e); return mapData; } GDataParser gDataParser = null; try { gDataParser = mapsClient.getParserForFeed(MapFeatureEntry.class, MapsClient.getMapsFeed(), authToken); gDataParser.init(); while (gDataParser.hasMoreData()) { MapFeatureEntry entry = (MapFeatureEntry) gDataParser.readNextEntry(null); mapIds.add(MapsGDataConverter.getMapidForEntry(entry)); mapData.add(MapsGDataConverter.getMapMetadataForEntry(entry)); } } catch (Exception e) { Log.d(EndToEndTestUtils.LOG_TAG, "Unable to get maps", e); } finally { if (gDataParser != null) { gDataParser.close(); } } return mapData; }