PlayServices.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:pico-phonegap-base 作者:
@Override
public void onStateConflict(int stateKey, String resolvedVersion, byte[] localData, byte[] serverData) {
    // Need to resolve conflict between the two states.
    // We do that by taking the union of the two sets of cleared levels,
    // which means preserving the maximum star rating of each cleared
    // level:
    JSONObject json = new JSONObject();
    try{
        json.put("type", STATE_CONFLICTED);
        json.put("stateKey", stateKey);
        json.put("version", resolvedVersion);
        json.put("localData", new JSONObject(new String(localData)));
        json.put("serverData", new JSONObject(new String(serverData)));
    }catch(JSONException ex){
        Log.e(TAG, "STATE_CONFLICTED ["+stateKey+"] ["+resolvedVersion+"] exception: "+ex.getMessage());
        return;
    }

    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
    pluginResult.setKeepCallback(true);
    connectionCB.sendPluginResult(pluginResult);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号