Çözüm iletişim kutuları

Bu sayfada, entegrasyon kararlarıyla ilgili sorunların nasıl giderileceği açıklanmaktadır.

Bütünlük jetonu istendiğinde kullanıcıya Google Play iletişimi gösterebilirsiniz. İletişim, bütünlük değerlendirmesiyle ilgili bir veya daha fazla sorun olduğunda gösterilebilir. İletişim kutusu, uygulamanızın üst tarafında gösterilir ve kullanıcılardan sorunun kaynağını bulup çözmelerini ister. İletişim kapatıldıktan sonra Integrity API'ye bir istek daha göndererek sorunun düzeltildiğini doğrulayabilirsiniz.

Bütünlük iletişim kutusu isteğinde bulunma

İstemci bir bütünlük jetonu istediğinde StandardIntegrityToken (Standart API) ve IntegrityTokenResponse (Classic API) içinde sunulan yöntemi kullanabilirsiniz: showDialog(Activity activity, int integrityDialogTypeCode).

Aşağıdaki adımlarda, GET_LICENSED iletişim kutusu kodunu kullanarak çözüm iletişim kutusu göstermek için Play Integrity API'yi nasıl kullanabileceğiniz açıklanmaktadır. Uygulamanızın isteyebileceği diğer iletişim kutusu kodları bu bölümden sonra listelenmiştir.

  1. Uygulamanızdan bir bütünlük jetonu isteyin ve jetonu sunucunuza gönderin. Standart veya klasik isteği kullanabilirsiniz.

    Kotlin

    // Request an integrity token
    val tokenResponse: StandardIntegrityToken = requestIntegrityToken()
    // Send token to app server and get response on what to do next
    val yourServerResponse: YourServerResponse = sendToServer(tokenResponse.token())  

    Java

    // Request an integrity token
    StandardIntegrityToken tokenResponse = requestIntegrityToken();
    // Send token to app server and get response on what to do next
    YourServerResponse yourServerResponse = sendToServer(tokenResponse.token());  

    Unity

    // Request an integrity token
    StandardIntegrityToken tokenResponse = RequestIntegrityToken();
    // Send token to app server and get response on what to do next
    YourServerResponse yourServerResponse = sendToServer(tokenResponse.Token); 

    Unreal Engine

    // Request an integrity token
    StandardIntegrityToken* Response = RequestIntegrityToken();
    // Send token to app server and get response on what to do next
    YourServerResponse YourServerResponse = SendToServer(Response->Token); 

    Yerel

    /// Request an integrity token
    StandardIntegrityToken* response = requestIntegrityToken();
    /// Send token to app server and get response on what to do next
    YourServerResponse yourServerResponse = sendToServer(StandardIntegrityToken_getToken(response));
  2. Sunucunuzda bütünlük jetonunun şifresini çözün ve appLicensingVerdict alanını kontrol edin. Bu, aşağıdaki gibi görünebilir:

    // Licensing issue
    {
      ...
      "accountDetails": {
          "appLicensingVerdict": "UNLICENSED"
      }
    }
  3. Jeton appLicensingVerdict: "UNLICENSED" içeriyorsa uygulama istemcinize yanıt vererek lisanslama iletişim kutusunu göstermesini isteyin:

    Kotlin

    private fun getDialogTypeCode(integrityToken: String): Int{
      // Get licensing verdict from decrypted and verified integritytoken
      val licensingVerdict: String = getLicensingVerdictFromDecryptedToken(integrityToken)
    
      return if (licensingVerdict == "UNLICENSED") {
              1 // GET_LICENSED
          } else 0
    }

    Java

    private int getDialogTypeCode(String integrityToken) {
      // Get licensing verdict from decrypted and verified integrityToken
      String licensingVerdict = getLicensingVerdictFromDecryptedToken(integrityToken);
    
      if (licensingVerdict.equals("UNLICENSED")) {
        return 1; // GET_LICENSED
      }
      return 0;
    }

    Unity

    private int GetDialogTypeCode(string IntegrityToken) {
      // Get licensing verdict from decrypted and verified integrityToken
      string licensingVerdict = GetLicensingVerdictFromDecryptedToken(IntegrityToken);
    
      if (licensingVerdict == "UNLICENSED") {
        return 1; // GET_LICENSED
      }
      return 0;
    } 

    Unreal Engine

    private int GetDialogTypeCode(FString IntegrityToken) {
      // Get licensing verdict from decrypted and verified integrityToken
      FString LicensingVerdict = GetLicensingVerdictFromDecryptedToken(IntegrityToken);
    
      if (LicensingVerdict == "UNLICENSED") {
        return 1; // GET_LICENSED
      }
      return 0;
    } 

    Yerel

    private int getDialogTypeCode(string integrity_token) {
      /// Get licensing verdict from decrypted and verified integrityToken
      string licensing_verdict = getLicensingVerdictFromDecryptedToken(integrity_token);
    
      if (licensing_verdict == "UNLICENSED") {
        return 1; // GET_LICENSED
      }
      return 0;
    }
  4. Uygulamanızda, sunucunuzdan alınan istenen kodla showDialog işlevini çağırın:

    Kotlin

    // Show dialog as indicated by the server
    val showDialogType: Int? = yourServerResponse.integrityDialogTypeCode()
    if (showDialogType != null) {
      // Call showDialog with type code, the dialog will be shown on top of the
      // provided activity and complete when the dialog is closed.
      val integrityDialogResponseCode: Task<Int> =
      tokenResponse.showDialog(activity, showDialogType)
      // Handle response code, call the Integrity API again to confirm that
      // verdicts have been resolved.
    } 

    Java

    // Show dialog as indicated by the server
    @Nullable Integer showDialogType = yourServerResponse.integrityDialogTypeCode();
    if (showDialogType != null) {
      // Call showDialog with type code, the dialog will be shown on top of the
      // provided activity and complete when the dialog is closed.
      Task<Integer> integrityDialogResponseCode =
          tokenResponse.showDialog(activity, showDialogType);
      // Handle response code, call the Integrity API again to confirm that
      // verdicts have been resolved.
    }

    Unity

    IEnumerator ShowDialogCoroutine() {
      int showDialogType = yourServerResponse.IntegrityDialogTypeCode();
    
      // Call showDialog with type code, the dialog will be shown on top of the
      // provided activity and complete when the dialog is closed.
      var showDialogTask = tokenResponse.ShowDialog(showDialogType);
    
      // Wait for PlayAsyncOperation to complete.
      yield return showDialogTask;
    
      // Handle response code, call the Integrity API again to confirm that
      // verdicts have been resolved.
    } 

    Unreal Engine

    // .h
    void MyClass::OnShowDialogCompleted(
      EStandardIntegrityErrorCode Error,
      EIntegrityDialogResponseCode Response)
    {
      // Handle response code, call the Integrity API again to confirm that
      // verdicts have been resolved.
    }
    
    // .cpp
    void MyClass::RequestIntegrityToken()
    {
      UStandardIntegrityToken* Response = ...
      int TypeCode = YourServerResponse.integrityDialogTypeCode();
    
      // Create a delegate to bind the callback function.
      FShowDialogStandardOperationCompletedDelegate Delegate;
    
      // Bind the completion handler (OnShowDialogCompleted) to the delegate.
      Delegate.BindDynamic(this, &MyClass::OnShowDialogCompleted);
    
      // Call ShowDialog with TypeCode which completes when the dialog is closed.
      Response->ShowDialog(TypeCode, Delegate);
    }

    Yerel

    // Show dialog as indicated by the server
    int show_dialog_type = yourServerResponse.integrityDialogTypeCode();
    if (show_dialog_type != 0) {
      /// Call showDialog with type code, the dialog will be shown on top of the
      /// provided activity and complete when the dialog is closed.
      StandardIntegrityErrorCode error_code =
          IntegrityTokenResponse_showDialog(response, activity, show_dialog_type);
    
      /// Proceed to polling iff error_code == STANDARD_INTEGRITY_NO_ERROR
      if (error_code != STANDARD_INTEGRITY_NO_ERROR)
      {
          /// Remember to call the *_destroy() functions.
          return;
      }
    
      /// Use polling to wait for the async operation to complete.
      /// Note, the polling shouldn't block the thread where the IntegrityManager
      /// is running.
    
      IntegrityDialogResponseCode* response_code;
      error_code = StandardIntegrityToken_getDialogResponseCode(response, response_code);
    
      if (error_code != STANDARD_INTEGRITY_NO_ERROR)
      {
          /// Remember to call the *_destroy() functions.
          return;
      }
    
      /// Handle response code, call the Integrity API again to confirm that
      /// verdicts have been resolved.
    }
  5. İletişim kutusu, sağlanan etkinliğin üzerinde gösterilir. Kullanıcı iletişim kutusunu kapattığında görev bir yanıt koduyla tamamlanır.

  6. (İsteğe bağlı) Başka iletişim kutuları göstermek için başka bir jeton isteyin. Standart istekler gönderirseniz yeni bir değerlendirme almak için jeton sağlayıcıyı tekrar ısıtmanız gerekir.

Doğruluk iletişim kutusu kodları

GET_LICENSED (Tür Kodu 1)

Sonuç sorunu

Bu iletişim kutusu iki sorun için uygundur:

  • Yetkisiz erişim: appLicensingVerdict: "UNLICENSED". Bu, kullanıcı hesabının uygulamanız için bir hakka sahip olmadığı anlamına gelir. Bu durum, kullanıcının uygulamayı başka cihazdan yüklemesi veya Google Play dışında bir uygulama mağazasından edinmesi halinde ortaya çıkabilir.
  • Kurcalanmış uygulama: appRecognitionVerdict: "UNRECOGNIZED_VERSION". Bu, uygulamanızın ikili programının değiştirildiği veya Google Play tarafından tanınan bir sürüm olmadığı anlamına gelir.

Çözüm

Kullanıcıdan Google Play'den orijinal uygulamayı edinmesini istemek için GET_LICENSED iletişim kutusunu gösterebilirsiniz. Bu tek iletişim kutusu her iki senaryoyu da ele alır:

  • Lisanssız bir kullanıcıya Play lisansı verilir. Bu sayede kullanıcı, Google Play'den uygulama güncellemeleri alabilir.
  • Değiştirilmiş bir uygulama sürümüne sahip olan kullanıcıları, Google Play'den değiştirilmemiş uygulamayı yüklemeye yönlendirir.

Kullanıcı iletişim kutusunu tamamladığında, sonraki bütünlük kontrolleri appLicensingVerdict: "LICENSED" ve appRecognitionVerdict: "PLAY_RECOGNIZED" değerlerini döndürür.

Kullanıcı deneyimi örneği

1.şekil GET_LICENSED Play iletişim kutusu.

CLOSE_UNKNOWN_ACCESS_RISK (Tür Kodu 2)

Sonuç sorunu

environmentDetails.appAccessRiskVerdict.appsDetected, "UNKNOWN_CAPTURING" veya "UNKNOWN_CONTROLLING" içerdiğinde cihazda ekranı kaydedebilecek ya da cihazı kontrol edebilecek bilinmeyen uygulamaların çalıştığı anlamına gelir.

Çözüm

Kullanıcıya ekranı yakalayan veya cihazı kontrol eden tüm bilinmeyen uygulamaları kapatmasını hatırlatmak için CLOSE_UNKNOWN_ACCESS_RISK iletişim kutusunu gösterebilirsiniz. Kullanıcı Close all düğmesine dokunursa bu tür uygulamaların tümü kapatılır.

Kullanıcı deneyimi örneği

Şekil 2. Bilinmeyen erişim riskini kapatma iletişim kutusu.

CLOSE_ALL_ACCESS_RISK (Tür Kodu 3)

Sonuç sorunu

environmentDetails.appAccessRiskVerdict.appsDetected, "KNOWN_CAPTURING","KNOWN_CONTROLLING", "UNKNOWN_CAPTURING" veya "UNKNOWN_CONTROLLING" simgelerinden herhangi birini içeriyorsa cihazda ekranı kaydedebilecek veya cihazı kontrol edebilecek uygulamalar çalışıyor demektir.

Çözüm

Kullanıcıya ekranı kaydedebilecek veya cihazı kontrol edebilecek tüm uygulamaları kapatmasını hatırlatmak için CLOSE_ALL_ACCESS_RISK iletişim kutusunu gösterebilirsiniz. Kullanıcı Close all düğmesine dokunursa bu tür uygulamaların tümü cihazda kapatılır.

Kullanıcı deneyimi örneği

3.şekil Tüm erişim riskini kapatma iletişim kutusu.