private void resolveConflict(string conflictId, SnapshotAndroid r)
 {
     mClient.CallClientApi("open snapshot metadata", () => {
         mClient.GHManager.CallGmsApiWithResult("games.Games", "Snapshots", "resolveConflict",
                                                new OnOpenResultProxy(mClient, mListener), conflictId, r.javaObj());
     }, null);
 }
        public void onResult(AndroidJavaObject result)
        {
            Logger.d("OnOpenResultProxy.onResult, result=" + result);

            if (result == null)
            {
                Logger.e("OnOpenResultProxy: result is null.");
                return;
            }

            int statusCode = JavaUtil.GetStatusCode(result);

            Logger.d("OnOpenResultProxy: status code is " + statusCode);

            AndroidJavaObject openedResult =
                JavaUtil.CallNullSafeObjectMethod(result, "getSnapshot");
            AndroidJavaObject conflictResult =
                JavaUtil.CallNullSafeObjectMethod(result, "getConflictingSnapshot");

            Snapshot opened   = null;
            Snapshot conflict = null;

            if (conflictResult != null)
            {
                conflict = new SnapshotAndroid(mClient, conflictResult);
                opened   = new SnapshotAndroid(mClient, openedResult);
                string conflictId = result.Call <string>("getConflictId");
                if (mListener != null)
                {
                    Logger.d("OnOpenResultProxy.onResult invoke conflict callback.");
                    PlayGamesHelperObject.RunOnGameThread(() => {
                        SnapshotAndroid r = mListener.OnSnapshotConflict(conflict, opened) as SnapshotAndroid;
                        resolveConflict(conflictId, r);
                    });
                }
            }
            else if (openedResult != null)
            {
                opened = new SnapshotAndroid(mClient, openedResult);
                if (mListener != null)
                {
                    Logger.d("OnOpenResultProxy.onResult invoke opened callback.");
                    PlayGamesHelperObject.RunOnGameThread(() => {
                        mListener.OnSnapshotOpened(statusCode, opened);
                    });
                }
            }
            else
            {
                Logger.d("OnOpenResultProxy: both openedResult and conflictResult are null!");
                if (mListener != null)
                {
                    Logger.d("OnOpenResultProxy.onResult invoke fail callback.");
                    PlayGamesHelperObject.RunOnGameThread(() => {
                        mListener.OnSnapshotOpened(statusCode, null);
                    });
                }
            }
        }