ย้ายข้อมูลไปยังบริการเกมของ Play v2 (Java หรือ Kotlin)

เอกสารนี้อธิบายวิธีย้ายข้อมูลเกมที่มีอยู่จาก games v1 SDK ไปยัง games v2 SDK

ก่อนเริ่มต้น

คุณใช้ IDE ที่ต้องการ เช่น Android Studio เพื่อย้ายข้อมูลเกมได้ ทําตามขั้นตอนต่อไปนี้ให้เรียบร้อยก่อนย้ายข้อมูลไปยัง Games v2

อัปเดตทรัพยากร Dependency

  1. ในไฟล์ build.gradle ของโมดูล ให้ค้นหาบรรทัดนี้ในข้อกำหนดระดับโมดูล

    implementation "com.google.android.gms:play-services-games-v1:+"

    แทนที่ด้วยโค้ดต่อไปนี้

    implementation "com.google.android.gms:play-services-games-v2:version"

    แทนที่ version ด้วย SDK เกมเวอร์ชันล่าสุด

  2. หลังจากอัปเดต Dependency แล้ว ให้ตรวจสอบว่าคุณได้ทำตามขั้นตอนทั้งหมดในเอกสารนี้

ย้ายข้อมูลจาก Google Sign-In ที่เลิกใช้งานแล้ว

แทนที่ชั้นเรียน GoogleSignInClient ด้วยชั้นเรียน GamesSignInClient

Java

ค้นหาไฟล์ที่มีชั้นเรียน GoogleSignInClient

import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;

// ... existing code

@Override
public void onCreate(@Nullable Bundle bundle) {
    super.onCreate(bundle);

    // ... existing code

    val signInOptions = GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN
    // Client used to sign in to Google services
    GoogleSignInClient googleSignInClient =
        GoogleSignIn.getClient(this, signInOptions);
}

และอัปเดตเป็นข้อความนี้

import com.google.android.gms.games.PlayGamesSdk;
import com.google.android.gms.games.PlayGames;
import com.google.android.gms.games.GamesSignInClient;

// ... existing code

@Override
public void onCreate(){
    super.onCreate();
    // Client used to sign in to Google services
    GamesSignInClient gamesSignInClient =
        PlayGames.getGamesSignInClient(getActivity());
}

Kotlin

ค้นหาไฟล์ที่มีชั้นเรียน GoogleSignInClient

import com.google.android.gms.auth.api.signin.GoogleSignIn
import com.google.android.gms.auth.api.signin.GoogleSignInClient
import com.google.android.gms.auth.api.signin.GoogleSignInOptions

// ... existing code

val signInOptions = GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN

// ... existing code

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    val googleSignInClient: GoogleSignInClient =
        GoogleSignIn.getClient(this, signInOptions)
}

และอัปเดตเป็นข้อความนี้

import com.google.android.gms.games.PlayGames
import com.google.android.gms.games.PlayGamesSdk
import com.google.android.gms.games.GamesSignInClient

// ... existing code

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    PlayGamesSdk.initialize(this)
    // client used to sign in to Google services
    val gamesSignInClient: GamesSignInClient =
        PlayGames.getGamesSignInClient(this)
}

อัปเดตรหัส GoogleSignIn

SDK เวอร์ชัน 2 ของเกมไม่รองรับ GoogleSignIn API และขอบเขต แทนที่โค้ด GoogleSignIn API สำหรับขอบเขต OAuth 2.0 ด้วย GamesSignInClient API ดังที่แสดงในตัวอย่างต่อไปนี้

Java

ค้นหาไฟล์ที่มีคลาสและขอบเขต GoogleSignIn

// Request code used when invoking an external activity.
private static final int RC_SIGN_IN = 9001;

private boolean isSignedIn() {
    GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);
    GoogleSignInOptions signInOptions =
    GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN;
    return GoogleSignIn.hasPermissions(account, signInOptions.getScopeArray());
}

private void signInSilently() {
    GoogleSignInOptions signInOptions =
        GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN;
    GoogleSignInClient signInClient = GoogleSignIn.getClient(this, signInOptions);
    signInClient
        .silentSignIn()
        .addOnCompleteListener(
            this,
            task -> {
            if (task.isSuccessful()) {
                // The signed-in account is stored in the task's result.
                GoogleSignInAccount signedInAccount = task.getResult();
                showSignInPopup();
            } else {
                // Perform interactive sign in.
                startSignInIntent();
            }
        });
}

private void startSignInIntent() {
    GoogleSignInClient signInClient = GoogleSignIn.getClient(this,
        GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
    Intent intent = signInClient.getSignInIntent();
    startActivityForResult(intent, RC_SIGN_IN);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result =
        Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {
            // The signed-in account is stored in the result.
            GoogleSignInAccount signedInAccount = result.getSignInAccount();
            showSignInPopup();
        } else {
            String message = result.getStatus().getStatusMessage();
            if (message == null || message.isEmpty()) {
                message = getString(R.string.signin_other_error);
        }
        new AlertDialog.Builder(this).setMessage(message)
            .setNeutralButton(android.R.string.ok, null).show();
        }
    }
}

private void showSignInPopup() {
Games.getGamesClient(requireContext(), signedInAccount)
    .setViewForPopups(contentView)
    .addOnCompleteListener(
        task -> {
            if (task.isSuccessful()) {
                logger.atInfo().log("SignIn successful");
            } else {
                logger.atInfo().log("SignIn failed");
            }
        });
  }

และอัปเดตเป็นข้อความนี้

private void signInSilently() {
    gamesSignInClient.isAuthenticated().addOnCompleteListener(isAuthenticatedTask -> {
    boolean isAuthenticated =
        (isAuthenticatedTask.isSuccessful() &&
            isAuthenticatedTask.getResult().isAuthenticated());
        if (isAuthenticated) {
            // Continue with Play Games Services
        } else {
            // If authentication fails, either disable Play Games Services
            // integration or
            // display a login button to prompt players to sign in.
            // Use`gamesSignInClient.signIn()` when the login button is clicked.
        }
    });
}

@Override
protected void onResume() {
    super.onResume();
    // When the activity is inactive, the signed-in user's state can change;
    // therefore, silently sign in when the app resumes.
    signInSilently();
}

Kotlin

ค้นหาไฟล์ที่มีคลาสและขอบเขต GoogleSignIn

// Request codes we use when invoking an external activity.
private val RC_SIGN_IN = 9001

// ... existing code

private fun isSignedIn(): Boolean {
    val account = GoogleSignIn.getLastSignedInAccount(this)
    val signInOptions = GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN
    return GoogleSignIn.hasPermissions(account, *signInOptions.scopeArray)
}

private fun signInSilently() {
    val signInOptions = GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN
    val signInClient = GoogleSignIn.getClient(this, signInOptions)
    signInClient.silentSignIn().addOnCompleteListener(this) { task ->
        if (task.isSuccessful) {
            // The signed-in account is stored in the task's result.
            val signedInAccount = task.result
            // Pass the account to showSignInPopup.
            showSignInPopup(signedInAccount)
        } else {
            // Perform interactive sign in.
            startSignInIntent()
        }
    }
}

private fun startSignInIntent() {
    val signInClient = GoogleSignIn.getClient(this, GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
    val intent = signInClient.signInIntent
    startActivityForResult(intent, RC_SIGN_IN)
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (requestCode == RC_SIGN_IN) {
        val result = Auth.GoogleSignInApi.getSignInResultFromIntent(data)
        if (result.isSuccess) {
            // The signed-in account is stored in the result.
            val signedInAccount = result.signInAccount
            showSignInPopup(signedInAccount) // Pass the account to showSignInPopup.
        } else {
            var message = result.status.statusMessage
            if (message == null || message.isEmpty()) {
                message = getString(R.string.signin_other_error)
        }
        AlertDialog.Builder(this)
            .setMessage(message)
            .setNeutralButton(android.R.string.ok, null)
            .show()
        }
    }
}

private fun showSignInPopup(signedInAccount: GoogleSignInAccount) {
    // Add signedInAccount parameter.
    Games.getGamesClient(this, signedInAccount)
        .setViewForPopups(contentView) // Assuming contentView is defined.
        .addOnCompleteListener { task ->
        if (task.isSuccessful) {
            logger.atInfo().log("SignIn successful")
        } else {
            logger.atInfo().log("SignIn failed")
        }
    }
}

และอัปเดตเป็นข้อความนี้

private fun signInSilently() {
    gamesSignInClient.isAuthenticated.addOnCompleteListener { isAuthenticatedTask ->
        val isAuthenticated = isAuthenticatedTask.isSuccessful &&
        isAuthenticatedTask.result.isAuthenticated
        if (isAuthenticated) {
            // Continue with Play Games Services
        } else {
            // To handle a user who is not signed in, either disable Play Games Services integration
            // or display a login button. Selecting this button calls `gamesSignInClient.signIn()`.
        }
    }
}

override fun onResume() {
    super.onResume()
    // Since the state of the signed in user can change when the activity is
    // not active it is recommended to try and sign in silently from when the
    // app resumes.
    signInSilently()
}

เพิ่มโค้ด GamesSignInClient

หากผู้เล่นลงชื่อเข้าใช้สำเร็จ ให้นำปุ่มลงชื่อเข้าใช้บริการเกมของ Play ออกจากเกม หากผู้ใช้เลือกไม่ลงชื่อเข้าใช้เมื่อเกมเปิดขึ้น ให้แสดงปุ่มที่มีไอคอนบริการเกมของ Play ต่อไป และเริ่มกระบวนการเข้าสู่ระบบด้วย GamesSignInClient.signIn()

Java

private void startSignInIntent() {
    gamesSignInClient
        .signIn()
        .addOnCompleteListener( task -> {
            if (task.isSuccessful() && task.getResult().isAuthenticated()) {
                // sign in successful
            } else {
                // sign in failed
            }
        });
  }

Kotlin

private fun startSignInIntent() {
    gamesSignInClient
        .signIn()
        .addOnCompleteListener { task ->
            if (task.isSuccessful && task.result.isAuthenticated) {
                // sign in successful
            } else {
                // sign in failed
            }
        }
  }

นำรหัสการลงชื่อออกออก

นำรหัสสำหรับ GoogleSignInClient.signOut ออก

นำโค้ดที่แสดงในตัวอย่างต่อไปนี้ออก

Java

// ... existing code

private void signOut() {
    GoogleSignInClient signInClient = GoogleSignIn.getClient(this,
    GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
    signInClient.signOut().addOnCompleteListener(this,
    new OnCompleteListener() {
        @Override
        public void onComplete(@NonNull Task task) {
           // At this point, the user is signed out.
        }
    });
}

Kotlin

// ... existing code

private fun signOut() {
    val signInClient = GoogleSignIn.getClient(this, GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
    signInClient.signOut().addOnCompleteListener(this) {
    // At this point, the user is signed out.
    }
}

ตรวจสอบการลงชื่อเข้าใช้อัตโนมัติที่สำเร็จ

ใส่โค้ดต่อไปนี้เพื่อตรวจสอบว่าคุณลงชื่อเข้าใช้โดยอัตโนมัติหรือไม่ และเพิ่มตรรกะที่กำหนดเองหากมี

Java

private void checkIfAutomaticallySignedIn() {
gamesSignInClient.isAuthenticated().addOnCompleteListener(isAuthenticatedTask -> {
boolean isAuthenticated =
    (isAuthenticatedTask.isSuccessful() &&
    isAuthenticatedTask.getResult().isAuthenticated());

    if (isAuthenticated) {
        // Continue with Play Games Services
        // If your game requires specific actions upon successful sign-in,
        // you can add your custom logic here.
        // For example, fetching player data or updating UI elements.
    } else {
        // Disable your integration with Play Games Services or show a
        // login button to ask  players to sign-in. Clicking it should
        // call GamesSignInClient.signIn().
        }
    });
}

Kotlin

private void checkIfAutomaticallySignedIn() {
gamesSignInClient.isAuthenticated()
    .addOnCompleteListener { task ->
    val isAuthenticated = task.isSuccessful && task.result?.isAuthenticated ?: false

        if (isAuthenticated) {
            // Continue with Play Games Services
        } else {
            // Disable your integration or show a login button
        }
    }
}

อัปเดตชื่อและเมธอดของคลาสไคลเอ็นต์

เมื่อย้ายข้อมูลไปยัง Games v2 วิธีการที่ใช้รับชื่อคลาสไคลเอ็นต์จะแตกต่างกัน ใช้เมธอด PlayGames.getxxxClient() ที่เกี่ยวข้องแทนเมธอด Games.getxxxClient()

เช่น สำหรับ LeaderboardsClient ให้ใช้ PlayGames.getLeaderboardsClient() แทนวิธีการ Games.getLeaderboardsClient()

Java

ค้นหารหัสสำหรับ LeaderboardsClient

import com.google.android.gms.games.LeaderboardsClient;
import com.google.android.gms.games.Games;

@Override
public void onCreate(@Nullable Bundle bundle) {
    super.onCreate(bundle);
        // Get the leaderboards client using Play Games services.
    LeaderboardsClient leaderboardsClient = Games.getLeaderboardsClient(this,
        GoogleSignIn.getLastSignedInAccount(this));
}

และอัปเดตเป็นข้อความนี้

import com.google.android.gms.games.LeaderboardsClient;
import com.google.android.gms.games.PlayGames;

 @Override
public void onCreate(@Nullable Bundle bundle) {
    super.onCreate(bundle);
        // Get the leaderboards client using Play Games services.
        LeaderboardsClient leaderboardsClient = PlayGames.getLeaderboardsClient(getActivity());
}

Kotlin

ค้นหารหัสสำหรับ LeaderboardsClient

import com.google.android.gms.games.LeaderboardsClient
import com.google.android.gms.games.Games
// Initialize the variables.
private lateinit var leaderboardsClient: LeaderboardsClient

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    leaderboardsClient = Games.getLeaderboardsClient(this,
        GoogleSignIn.getLastSignedInAccount(this))
}

และอัปเดตเป็นข้อความนี้

import com.google.android.gms.games.LeaderboardsClient
import com.google.android.gms.games.PlayGames
    // Initialize the variables.
private lateinit var leaderboardsClient: LeaderboardsClient

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    leaderboardsClient = PlayGames.getLeaderboardsClient(this)
}

ในทํานองเดียวกัน ให้ใช้เมธอดที่สอดคล้องกันสําหรับไคลเอ็นต์ต่อไปนี้ AchievementsClient, EventsClient, GamesSignInClient, PlayerStatsClient, RecallClient, SnapshotsClient หรือ PlayersClient

อัปเดตคลาสการเข้าถึงฝั่งเซิร์ฟเวอร์

หากต้องการขอโทเค็นการเข้าถึงฝั่งเซิร์ฟเวอร์ ให้ใช้วิธี GamesSignInClient.requestServerSideAccess() แทนวิธี GoogleSignInAccount.getServerAuthCode()

ตัวอย่างต่อไปนี้แสดงวิธีขอโทเค็นการเข้าถึงฝั่งเซิร์ฟเวอร์

Java

ค้นหารหัสของชั้นเรียน GoogleSignInOptions

    private static final int RC_SIGN_IN = 9001;
    private GoogleSignInClient googleSignInClient;

    private void startSignInForAuthCode() {
        /** Client ID for your backend server. */
        String webClientId = getString(R.string.webclient_id);
        GoogleSignInOptions signInOption = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
            .requestServerAuthCode(webClientId)
            .build();

        GoogleSignInClient signInClient = GoogleSignIn.getClient(this, signInOption);
        Intent intent = signInClient.getSignInIntent();
        startActivityForResult(intent, RC_SIGN_IN);
    }

    /** Auth code to send to backend server */
    private String mServerAuthCode;

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == RC_SIGN_IN) {
            GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {
            mServerAuthCode = result.getSignInAccount().getServerAuthCode();
        } else {
            String message = result.getStatus().getStatusMessage();
            if (message == null || message.isEmpty()) {
                message = getString(R.string.signin_other_error);
            }
            new AlertDialog.Builder(this).setMessage(message)
                .setNeutralButton(android.R.string.ok, null).show();
        }
      }
    }
  

และอัปเดตเป็นข้อความนี้

  private void startRequestServerSideAccess() {
      GamesSignInClient gamesSignInClient = PlayGames.getGamesSignInClient(this);
      gamesSignInClient
          .requestServerSideAccess(OAUTH_2_WEB_CLIENT_ID, /* forceRefreshToken= */ false)
          .addOnCompleteListener(task -> {
              if (task.isSuccessful()) {
                  String serverAuthToken = task.getResult();
                  // Send authentication code to the backend game server.
                  // Exchange for an access token.
                  // Verify the player with Play Games Services REST APIs.
              } else {
                // Authentication code retrieval failed.
              }
        });
  }
  

Kotlin

ค้นหารหัสของชั้นเรียน GoogleSignInOptions

  // ... existing code

  private val RC_SIGN_IN = 9001
  private lateinit var googleSignInClient: GoogleSignInClient

  // Auth code to send to backend server.
  private var mServerAuthCode: String? = null

  private fun startSignInForAuthCode() {
      // Client ID for your backend server.
      val webClientId = getString(R.string.webclient_id)

      val signInOption = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
          .requestServerAuthCode(webClientId)
          .build()

      googleSignInClient = GoogleSignIn.getClient(this, signInOption)
      val intent = googleSignInClient.signInIntent
      startActivityForResult(intent, RC_SIGN_IN)
  }

  override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
      super.onActivityResult(requestCode, resultCode, data)
      if (requestCode == RC_SIGN_IN) {
          val result = Auth.GoogleSignInApi.getSignInResultFromIntent(data)
          if (result.isSuccess) {
              mServerAuthCode = result.signInAccount.serverAuthCode
          } else {
              var message = result.status.statusMessage
              if (message == null || message.isEmpty()) {
                  message = getString(R.string.signin_other_error)
              }
              AlertDialog.Builder(this).setMessage(message)
                  .setNeutralButton(android.R.string.ok, null).show()
            }
        }
  }
  

และอัปเดตเป็นข้อความนี้

  private void startRequestServerSideAccess() {
  GamesSignInClient gamesSignInClient = PlayGames.getGamesSignInClient(this);
      gamesSignInClient
          .requestServerSideAccess(OAUTH_2_WEB_CLIENT_ID, /* forceRefreshToken= */ false)
          .addOnCompleteListener(task -> {
              if (task.isSuccessful()) {
                  String serverAuthToken = task.getResult();
                  // Send authentication code to the backend game server.
                  // Exchange for an access token.
                  // Verify the player with Play Games Services REST APIs.
              } else {
                // Authentication code retrieval failed.
              }
        });
  }
  

ย้ายข้อมูลจาก GoogleApiClient

สําหรับการผสานรวมที่มีอยู่เดิม เกมของคุณอาจใช้GoogleApiClient API รูปแบบต่างๆ ของ Play Games Services SDK การดำเนินการนี้เลิกใช้งานไปเมื่อปลายปี 2017 และแทนที่ด้วยไคลเอ็นต์ "แบบไม่มีการเชื่อมต่อ" หากต้องการย้ายข้อมูล คุณสามารถแทนที่คลาส GoogleApiClient ด้วยคลาสที่เทียบเท่าแบบ "ไม่มีการเชื่อมต่อ" การแมปคลาสที่พบบ่อยมีดังนี้

games v2

  // Replace com.google.android.gms.games.achievement.Achievements
  com.google.android.gms.games.AchievementsClient
  // Replace com.google.android.gms.games.leaderboard.Leaderboard
  com.google.android.gms.games.LeaderboardsClient
  // Replace com.google.android.gms.games.snapshot.Snapshots
  com.google.android.gms.games.SnapshotsClient
  // Replace com.google.android.gms.games.stats.PlayerStats
  com.google.android.gms.games.PlayerStatsClient
  // Replace com.google.android.gms.games.Players
  com.google.android.gms.games.PlayersClient
  // Replace com.google.android.gms.games.GamesStatusCodes
  com.google.android.gms.games.GamesClientStatusCodes
  
  

games v1

  com.google.android.gms.games.achievement.Achievements
  com.google.android.gms.games.leaderboard.Leaderboard
  com.google.android.gms.games.snapshot.Snapshots
  com.google.android.gms.games.stats.PlayerStats
  com.google.android.gms.games.Players
  com.google.android.gms.games.GamesStatusCodes
  

สร้างและเรียกใช้เกม

หากต้องการสร้างและเรียกใช้ใน Android Studio ให้ดูสร้างและเรียกใช้แอป

ทดสอบเกม

ตรวจสอบว่าเกมทำงานตามที่ออกแบบไว้ด้วยการทดสอบ การทดสอบที่คุณทำจะขึ้นอยู่กับฟีเจอร์ของเกม

ต่อไปนี้คือรายการการทดสอบทั่วไปที่ควรทํา

  1. ลงชื่อเข้าใช้สำเร็จ

    1. การลงชื่อเข้าใช้โดยอัตโนมัติใช้งานได้ ผู้ใช้ควรลงชื่อเข้าใช้บริการเกมของ Play เมื่อเปิดเกม

    2. ป๊อปอัปต้อนรับจะปรากฏขึ้น

      ตัวอย่างป๊อปอัปต้อนรับ
      ตัวอย่างป๊อปอัปต้อนรับ (คลิกเพื่อขยาย)

    3. ข้อความบันทึกที่ดำเนินการสำเร็จจะปรากฏขึ้น เรียกใช้คำสั่งต่อไปนี้ในเทอร์มินัล

      adb logcat | grep com.google.android.

      ตัวอย่างข้อความบันทึกที่สำเร็จจะแสดงดังต่อไปนี้

      [$PlaylogGamesSignInAction$SignInPerformerSource@e1cdecc
      number=1 name=GAMES_SERVICE_BROKER>], returning true for shouldShowWelcomePopup.
      [CONTEXT service_id=1 ]
  2. ตรวจสอบความสอดคล้องของคอมโพเนนต์ UI

    1. ป๊อปอัป ลีดเดอร์บอร์ด และรางวัลพิเศษแสดงอย่างถูกต้องและสอดคล้องกันในขนาดและการวางแนวหน้าจอต่างๆ ในอินเทอร์เฟซผู้ใช้ (UI) ของบริการเกมของ Play

    2. ตัวเลือกการลงชื่อออกไม่ปรากฏใน UI ของบริการเกมของ Play

    3. รหัสผู้เล่นสอดคล้องกันและสามารถใช้สำหรับการผสานรวมแบ็กเอนด์ได้

    4. หากเกมใช้การตรวจสอบสิทธิ์ฝั่งเซิร์ฟเวอร์ ให้ทดสอบขั้นตอนต่างๆ ของrequestServerSideAccessอย่างละเอียด ตรวจสอบว่าเซิร์ฟเวอร์ได้รับรหัสการให้สิทธิ์และสามารถแลกรหัสดังกล่าวเป็นโทเค็นการเข้าถึงได้ ทดสอบทั้งสถานการณ์ที่สำเร็จและไม่สำเร็จสำหรับข้อผิดพลาดเกี่ยวกับเครือข่าย สถานการณ์ที่ไม่ถูกต้อง และclient ID

หากเกมของคุณใช้ฟีเจอร์ต่อไปนี้ ให้ทดสอบฟีเจอร์ดังกล่าวเพื่อให้แน่ใจว่าทำงานเหมือนเดิมก่อนการย้ายข้อมูล

  • ลีดเดอร์บอร์ด: ส่งคะแนนและดูลีดเดอร์บอร์ด ตรวจสอบการจัดอันดับที่ถูกต้องและการแสดงชื่อและคะแนนของผู้เล่น
  • รางวัลพิเศษ: ปลดล็อกรางวัลพิเศษและตรวจสอบว่าบันทึกรางวัลพิเศษอย่างถูกต้องและแสดงใน UI ของ Play Games
  • เกมที่บันทึกไว้: หากเกมใช้เกมที่บันทึกไว้ ให้ตรวจสอบว่าการบันทึกและโหลดความคืบหน้าของเกมทำงานได้อย่างราบรื่น ซึ่งสำคัญอย่างยิ่งในการทดสอบในอุปกรณ์หลายเครื่องและหลังการอัปเดตแอป

งานหลังการย้ายข้อมูล

ทำตามขั้นตอนต่อไปนี้ให้เสร็จสมบูรณ์หลังจากย้ายข้อมูลไปยัง Games v2 แล้ว

เผยแพร่เกม

สร้าง APK และเผยแพร่เกมใน Play Console

  1. ในเมนู Android Studio ให้เลือก สร้าง > สร้างกลุ่ม / APK > สร้าง APK
  2. เผยแพร่เกม ดูข้อมูลเพิ่มเติมได้ที่หัวข้อเผยแพร่แอปส่วนตัวจาก Play Console