इस पेज पर, इंटिग्रिटी वर्शन से जुड़ी समस्याओं को हल करने का तरीका बताया गया है.
इंटिग्रिटी टोकन का अनुरोध किए जाने पर, आपके पास उपयोगकर्ता को Google Play डायलॉग दिखाने का विकल्प होता है. डायलॉग तब दिखाया जा सकता है, जब इंटिग्रिटी के फ़ैसले से जुड़ी एक या उससे ज़्यादा समस्याएं हों. यह डायलॉग, आपके ऐप्लिकेशन के सबसे ऊपर दिखता है. साथ ही, लोगों को समस्या की वजह ठीक करने के लिए कहता है. डायलॉग बॉक्स बंद होने के बाद, यह पुष्टि की जा सकती है कि समस्या ठीक हो गई है. इसके लिए, Integrity API को एक और अनुरोध भेजें.
इंटिग्रिटी डायलॉग का अनुरोध करना
जब क्लाइंट, इंटिग्रिटी टोकन का अनुरोध करता है, तब StandardIntegrityToken (स्टैंडर्ड एपीआई) और IntegrityTokenResponse (क्लासिक एपीआई) में दिए गए तरीके का इस्तेमाल किया जा सकता है:
showDialog(Activity activity, int integrityDialogTypeCode)
.
यहां दिए गए चरणों में बताया गया है कि GET_LICENSED डायलॉग कोड का इस्तेमाल करके, समस्या हल करने वाला डायलॉग दिखाने के लिए Play Integrity API का इस्तेमाल कैसे किया जा सकता है. इस सेक्शन के बाद, ऐसे अन्य डायलॉग कोड की सूची दी गई है जिनके लिए आपका ऐप्लिकेशन अनुरोध कर सकता है.
अपने ऐप्लिकेशन से इंटिग्रिटी टोकन का अनुरोध करें और टोकन को अपने सर्वर पर भेजें. स्टैंडर्ड या क्लासिक अनुरोध का इस्तेमाल किया जा सकता है.
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);
मूल भाषा वाला
/// 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));
अपने सर्वर पर, इंटिग्रिटी टोकन को डिक्रिप्ट करें और
appLicensingVerdict
फ़ील्ड की जांच करें. यह कुछ इस तरह दिख सकता है:// Licensing issue { ... accountDetails: { appLicensingVerdict: "UNLICENSED" } }
अगर टोकन में
appLicensingVerdict: "UNLICENSED"
मौजूद है, तो अपने ऐप्लिकेशन क्लाइंट को जवाब दें और उससे लाइसेंसिंग डायलॉग दिखाने का अनुरोध करें: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; }
मूल भाषा वाला
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; }
अपने ऐप्लिकेशन पर, अपने सर्वर से वापस पाए गए कोड के साथ
showDialog
को कॉल करें: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); }
मूल भाषा वाला
// 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. }
डायलॉग बॉक्स, दी गई गतिविधि के ऊपर दिखता है. जब उपयोगकर्ता डायलॉग बंद कर देता है, तो टास्क जवाब कोड के साथ पूरा हो जाता है.
(ज़रूरी नहीं) अन्य डायलॉग दिखाने के लिए, किसी दूसरे टोकन का अनुरोध करें. अगर स्टैंडर्ड अनुरोध किए जाते हैं, तो आपको नया फ़ैसला पाने के लिए, टोकन देने वाली कंपनी को फिर से वॉर्म अप करना होगा.
डायलॉग बॉक्स के इंटिग्रिटी कोड
GET_LICENSED (टाइप कोड 1)
नतीजे से जुड़ी समस्या
यह डायलॉग बॉक्स, दो समस्याओं के लिए सही है:
- बिना अनुमति के ऐक्सेस:
appLicensingVerdict: "UNLICENSED"
. इसका मतलब है कि उपयोगकर्ता के खाते के पास आपके ऐप्लिकेशन को इस्तेमाल करने का अधिकार नहीं है. ऐसा तब हो सकता है, जब उपयोगकर्ता ने ऐप्लिकेशन को अलग से लोड किया हो या उसे Google Play के अलावा किसी दूसरे ऐप्लिकेशन स्टोर से डाउनलोड किया हो. - छेड़छाड़ किया गया ऐप्लिकेशन:
appRecognitionVerdict: "UNRECOGNIZED_VERSION"
. इसका मतलब है कि आपके ऐप्लिकेशन की बाइनरी में बदलाव किया गया है या यह ऐसा वर्शन नहीं है जिसे Google Play ने मंज़ूरी दी है.
बचा हुआ डेटा एक्सपोर्ट करना
उपयोगकर्ता को GET_LICENSED
डायलॉग दिखाया जा सकता है, ताकि वह Google Play से असली ऐप्लिकेशन डाउनलोड कर सके. इस एक डायलॉग बॉक्स में, दोनों स्थितियों के बारे में बताया गया है:
- बिना लाइसेंस वाले उपयोगकर्ता को Play का लाइसेंस मिलता है. इससे उपयोगकर्ता को Google Play से ऐप्लिकेशन के अपडेट मिलते हैं.
- छेड़छाड़ किए गए ऐप्लिकेशन के वर्शन का इस्तेमाल करने वाले व्यक्ति को, Google Play से बिना बदलाव वाला ऐप्लिकेशन इंस्टॉल करने के लिए कहा जाता है.
जब उपयोगकर्ता डायलॉग को पूरा कर लेता है, तो इसके बाद की जाने वाली इंटिग्रिटी की जांच में appLicensingVerdict: "LICENSED"
और appRecognitionVerdict: "PLAY_RECOGNIZED"
दिखता है.
UX का उदाहरण

CLOSE_UNKNOWN_ACCESS_RISK (टाइप कोड 2)
नतीजे से जुड़ी समस्या
अगर environmentDetails.appAccessRiskVerdict.appsDetected
में "UNKNOWN_CAPTURING"
या "UNKNOWN_CONTROLLING"
शामिल है, तो इसका मतलब है कि डिवाइस पर ऐसे ऐप्लिकेशन चल रहे हैं जिनके बारे में जानकारी नहीं है. ये ऐप्लिकेशन, स्क्रीन कैप्चर कर सकते हैं या डिवाइस को कंट्रोल कर सकते हैं.
बचा हुआ डेटा एक्सपोर्ट करना
उपयोगकर्ता को CLOSE_UNKNOWN_ACCESS_RISK
डायलॉग दिखाया जा सकता है. इससे उसे स्क्रीन कैप्चर करने या डिवाइस को कंट्रोल करने वाले सभी अनजान ऐप्लिकेशन बंद करने के लिए कहा जा सकता है.
अगर उपयोगकर्ता Close all
बटन पर टैप करता है, तो ऐसे सभी ऐप्लिकेशन बंद हो जाते हैं.
UX का उदाहरण

CLOSE_ALL_ACCESS_RISK (टाइप कोड 3)
नतीजे से जुड़ी समस्या
अगर environmentDetails.appAccessRiskVerdict.appsDetected
में "KNOWN_CAPTURING"
, "KNOWN_CONTROLLING"
,"UNKNOWN_CAPTURING"
या "UNKNOWN_CONTROLLING"
में से कोई भी मौजूद है, तो इसका मतलब है कि डिवाइस पर ऐसे ऐप्लिकेशन चल रहे हैं जो स्क्रीन कैप्चर कर सकते हैं या डिवाइस को कंट्रोल कर सकते हैं.
बचा हुआ डेटा एक्सपोर्ट करना
उपयोगकर्ता को CLOSE_ALL_ACCESS_RISK
डायलॉग दिखाया जा सकता है. इससे उपयोगकर्ता को उन सभी ऐप्लिकेशन को बंद करने के लिए कहा जाएगा जो स्क्रीन कैप्चर कर सकते हैं या डिवाइस को कंट्रोल कर सकते हैं. अगर उपयोगकर्ता Close all
बटन पर टैप करता है, तो डिवाइस पर ऐसे सभी ऐप्लिकेशन बंद हो जाते हैं.
UX का उदाहरण
