Google Play Services Leak

前端 未结 2 1814
天涯浪人
天涯浪人 2021-01-04 01:44

I started using Google Play Game Services a while ago, and yesterday while checking the logcat I couldnt help to notice this error:

E/DataBuffer(3183)

2条回答
  •  不知归路
    2021-01-04 02:05

    These items extend DataBuffer: AchievementBuffer, AppStateBuffer, FilteredDataBuffer, GameBuffer, InvitationBuffer, LeaderboardBuffer, LeaderboardScoreBuffer, MetadataBuffer, MomentBuffer, ParticipantBuffer, PersonBuffer, PlayerBuffer, TurnBasedMatchBuffer.

    These are generally found in your listeners of those particular items. For example:

    public void onTurnBasedMatchesLoaded(int statusCode, LoadMatchesResponse response) 
    {
        TurnBasedMatchBuffer buff = response.getMyTurnMatches();
        // do some stuff with buff
        buff.close()
    }
    
    public void onPlayersLoaded(int statusCode, PlayerBuffer buff) 
    {
        Player p = buff.get(0);
        buff.close();
    }
    

    The error doesn't report until after I exit my app and re-enter. If I call up my matches 3 times and exit the app without calling buff.close(), I can expect to see the warning 3 times upon opening it back up again. Add in the buff.close() and they disappear. Voila!

提交回复
热议问题