Çözüm

Bu sayfada, bütünlük kararlarıyla ilgili sorunların nasıl ele alınacağı 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 kısmında gösterilir ve kullanıcılardan sorunun nedenini çözmelerini ister. İletişim kapatıldıktan sonra, Integrity API'ye başka bir istek göndererek sorunun düzeltildiğini doğrulayabilirsiniz.

Bütünlük iletişim kutuları

GET_LICENSED (Tür Kodu 1)

Sonuç sorunu

appLicensingVerdict == "UNLICENSED" olduğunda. Bu, kullanıcı hesabının lisanssız olduğu anlamına gelir. Diğer bir deyişle, uygulamayı Google Play'den yüklememiştir veya satın almamıştır.

Çözüm

Kullanıcıdan uygulamanızı Google Play'den yüklemesini istemek için GET_LICENSED iletişim kutusunu gösterebilirsiniz. Kullanıcı kabul ederse kullanıcı hesabı lisanslanır (appLicensingVerdict == "LICENSED"). Uygulama, kullanıcının Google Play kitaplığına eklenir ve Google Play, uygulama güncellemelerini sizin adınıza yayınlayabilir.

Örnek kullanıcı deneyimi

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çeriyorsa cihazda ekranı kaydedebilecek ya da cihazı kontrol edebilecek bilinmeyen uygulamalar çalışıyor demektir.

Çözüm

Kullanıcıdan ekranı yakalayabilecek veya cihazı kontrol edebilecek tüm bilinmeyen uygulamaları kapatmasını istemek 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.

Örnek kullanıcı deneyimi

Bilinmeyen erişim riskini kapatma iletişim kutusu

CLOSE_ALL_ACCESS_RISK (Type Code 3)

Sonuç sorunu

environmentDetails.appAccessRiskVerdict.appsDetected, "KNOWN_CAPTURING","KNOWN_CONTROLLING", "UNKNOWN_CAPTURING" veya "UNKNOWN_CONTROLLING"'den herhangi birini içeriyorsa cihazda ekranı kaydeden veya cihazı kontrol eden uygulamalar çalışıyor demektir.

Çözüm

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

Örnek kullanıcı deneyimi

Tüm erişim riskini kapatma iletişim kutusu

Bütünlük iletişim kutusu isteme

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

Aşağıdaki adımlarda, GET_LICENSED iletişim kutusunu göstermek için Play Integrity API'yi nasıl kullanabileceğiniz açıklanmaktadır:

  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 istemcinizi yanıtlayarak 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 kodu showDialog ile ç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 üstünde 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örüntülemek için başka bir jeton isteyin. Standart istekler gönderirseniz yeni bir karar almak için jeton sağlayıcıyı tekrar ısıtmanız gerekir.