{"id":565,"date":"2023-11-14T16:45:32","date_gmt":"2023-11-14T08:45:32","guid":{"rendered":"http:\/\/pareto.fun\/?p=565"},"modified":"2023-11-23T16:37:56","modified_gmt":"2023-11-23T08:37:56","slug":"play-integrity-api-%e6%90%ad%e5%bb%ba%e3%80%81%e6%95%88%e6%9e%9c%e9%aa%8c%e8%af%81","status":"publish","type":"post","link":"http:\/\/pareto.fun\/?p=565","title":{"rendered":"play integrity api \u642d\u5efa\u3001\u6548\u679c\u9a8c\u8bc1\u3001\u7ed5\u8fc7"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\">\n<p><a href=\"https:\/\/developer.android.com\/google\/play\/integrity\/standard?hl=zh-cn#overview\">https:\/\/developer.android.com\/google\/play\/integrity\/standard?hl=zh-cn#overview<\/a> \u5b98\u65b9\u6587\u6863<\/p>\n\n\n\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/72395653\/how-to-call-decodeintegritytoken-api\">https:\/\/stackoverflow.com\/questions\/72395653\/how-to-call-decodeintegritytoken-api<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/72193058\/google-playintegrity-api-a-nightmare\">https:\/\/stackoverflow.com\/questions\/72193058\/google-playintegrity-api-a-nightmare<\/a> \u642d\u5efa\u6307\u5bfc<\/p>\n<\/blockquote>\n\n\n\n<p>\u642d\u5efa\u4f7f\u7528\u7684\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>        super.onCreate(savedInstanceState);\n\n        binding = ActivityMainBinding.inflate(getLayoutInflater());\n        setContentView(binding.getRoot());\n\n\n        \/\/ Create an instance of a manager.\n        StandardIntegrityManager standardIntegrityManager =\n                IntegrityManagerFactory.createStandard(this.getApplicationContext());\n\n        long cloudProjectNumber = 0L; \/\/ project number\n\n        \/\/ Prepare integrity token. Can be called once in a while to keep internal\n        \/\/ state fresh.\n        standardIntegrityManager.prepareIntegrityToken(\n                        StandardIntegrityManager.PrepareIntegrityTokenRequest.builder()\n                                .setCloudProjectNumber(cloudProjectNumber)\n                                .build())\n                .addOnSuccessListener(\n                    tokenProvider -&gt; {\n                        Log.e(\"TAG\",\"provider\");\n                        integrityTokenProvider = tokenProvider;\n                        String requestHash = \"2cp24zlkjlkjlklklk\";\n                        Task&lt;StandardIntegrityToken&gt; integrityTokenResponse =\n                                integrityTokenProvider.request(\n                                        StandardIntegrityManager.StandardIntegrityTokenRequest.builder()\n                                                .setRequestHash(requestHash)\n                                                .build());\n                        integrityTokenResponse\n                                .addOnSuccessListener(\n                                        new OnSuccessListener&lt;StandardIntegrityToken&gt;() {\n                                            @Override\n                                            public void onSuccess(StandardIntegrityToken standardIntegrityToken) {\n                                                Log.e(\"TAG\",\"standardIntegrityToken onSuccess\");\n                                                String token = standardIntegrityToken.token();\n                                                DecodeIntegrityTokenRequest requestObj = new DecodeIntegrityTokenRequest();\n                                                requestObj.setIntegrityToken(token);\n                                                \/\/Configure your credentials from the downloaded Json file from the resource\n                                                GoogleCredentials credentials = null;\n                                                try {\n                                                    credentials = GoogleCredentials.fromStream(Objects.requireNonNull(getClass().getClassLoader()).getResourceAsStream(\"credentials.json\"));\n                                                } catch (IOException e) {\n                                                    Log.e(\"TAG\",\"standardIntegrityToken error\");\n                                                    throw new RuntimeException(e);\n                                                }\n                                                HttpRequestInitializer requestInitializer = new HttpCredentialsAdapter(credentials);\n\n                                                HttpTransport HTTP_TRANSPORT = new NetHttpTransport();\n                                                JsonFactory JSON_FACTORY  = new JacksonFactory();\n                                                GoogleClientRequestInitializer initializer = new PlayIntegrityRequestInitializer();\n\n                                                PlayIntegrity.Builder playIntegrity = new PlayIntegrity.Builder(HTTP_TRANSPORT, JSON_FACTORY, requestInitializer).setApplicationName(\"com.example.myapplication\")\n                                                        .setGoogleClientRequestInitializer(initializer);\n                                                PlayIntegrity play  = playIntegrity.build();\n\n                                                Thread thread = new Thread(new Runnable() {\n                                                    @Override\n                                                    public void run() {\n                                                        try  {\n                                                            DecodeIntegrityTokenResponse response = play.v1().decodeIntegrityToken(\"com.example.myapplication\", requestObj).execute();\n                                                            Log.d(\"TAG\" ,\"licensingVerdict\\t\" +  response.getTokenPayloadExternal().getDeviceIntegrity().toString());                                                            String licensingVerdict = response.getTokenPayloadExternal().getAccountDetails().getAppLicensingVerdict();\n                                                            Log.d(\"TAG\" ,\"licensingVerdict\\t\" +licensingVerdict );\n                                                            if (licensingVerdict.equalsIgnoreCase(\"LICENSED\")) {\n                                                                Log.d(\"TAG\" ,\"LICENSED APP\");\n                                                                \/\/ Looks good! LICENSED app\n                                                            } else {\n                                                                Log.d(\"TAG\" ,\"LICENSED not APP\");\n                                                                \/\/ LICENSE NOT OK\n                                                            }\n                                                        } catch (Exception e) {\n                                                            Log.d(\"TAG\" ,\"LICENSED error \"+  e.getMessage());\n                                                            \/\/  LICENSE error\n                                                        }\n                                                    }\n                                                });\n                                                thread.start();\n\n                                            }\n                                        }\n\/\/                                        (response) -&gt; {\n\/\/                                            Log.e(\"TAG\" , response.token());\n\/\/                                        }\n                                )\n                                .addOnFailureListener((param1)-&gt;{\n                                    Log.e(\"TAG\",\"error2\");\n                                });\n\n                    }\n                )\n                .addOnFailureListener((param1)-&gt;{\n                    Log.e(\"TAG\",\"error \" + param1.getMessage());\n                });\n\n\n\n\n\/\/                .addOnFailureListener(exception -&gt; handleError(exception));\n\n        TextView tv = binding.sampleText;\n        tv.setText(stringFromJNI());<\/code><\/pre>\n\n\n\n<p>\u9ad8\u5ea6\u4f9d\u8d56google play \u5546\u57ce\uff0c\u672a\u5b89\u88c5google play\u5546\u57ce \u6216\u8005\u7248\u672c\u8fc7\u4f4e\uff0c\u90fd\u4e0d\u80fd\u7ed9\u51fa\u5224\u65ad\u7ed3\u679c\uff1b<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u672a\u5b89\u88c5google play<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"60\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-1024x60.png\" alt=\"\" class=\"wp-image-566\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-1024x60.png 1024w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-300x18.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-768x45.png 768w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image.png 1500w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u6a21\u62df\u5668 \u63d0\u793agoogle play \u7248\u672c\u8fc7\u4f4e<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"46\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-1-1024x46.png\" alt=\"\" class=\"wp-image-567\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-1-1024x46.png 1024w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-1-300x14.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-1-768x35.png 768w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-1-1536x69.png 1536w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-1.png 1574w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">magisk \u8bbe\u5907 \u5212\u4e3a\u4e0d\u53ef\u4fe1\u8bbe\u5907<\/h3>\n\n\n\n<p>deviceIntegrity \u503c\u4e3a\u7a7a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"787\" height=\"262\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-3.png\" alt=\"\" class=\"wp-image-569\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-3.png 787w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-3-300x100.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-3-768x256.png 768w\" sizes=\"(max-width: 787px) 100vw, 787px\" \/><\/figure>\n\n\n\n<p>\u7ecf\u8fc7\u53cd\u590d\u5237\u673a\u9a8c\u8bc1\uff0c\u63a7\u5236\u5355\u4e00\u53d8\u91cf\uff0c\u5237\u5165\u539f\u5382\u7684\u955c\u50cf\u65f6 \uff0cflash\u4e3alock \u6216 unlock \uff0c play integrity \u5224\u5b9a\u4e3a\u6b63\u5e38 \u6216\u5f02\u5e38\u8bbe\u5907\u3002<\/p>\n\n\n\n<p>\u5bf9\u6bd4lock \u548c unlock\u524d\u540e\u7684\u7cfb\u7edf\u5c5e\u6027\uff0c\u53d6\u5176\u4e2d\u5173\u952e\u7684\u5c5e\u6027\uff1b<\/p>\n\n\n\n<ol start=\"1\">\n<li>ro.boot.vbmeta.device_state<\/li>\n\n\n\n<li>ro.boot.verifiedbootstate<\/li>\n\n\n\n<li>ro.boot.veritymode<\/li>\n\n\n\n<li>ro.boot.flash.locked<\/li>\n<\/ol>\n\n\n\n<p>\u5c06\u5c5e\u6027\u8bbe\u7f6e\u6210locked\u65f6\u7684\u5c5e\u6027. \u4ecd\u4e0d\u80fd\u9976\u8fc7 Play integrity\u3002<\/p>\n\n\n\n<p>\u7814\u7a76PlayIntegrityFix \u63d2\u4ef6\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"790\" height=\"128\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-4.png\" alt=\"\" class=\"wp-image-579\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-4.png 790w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-4-300x49.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-4-768x124.png 768w\" sizes=\"(max-width: 790px) 100vw, 790px\" \/><\/figure>\n\n\n\n<p>\u6838\u5fc3\u7684\u4e24\u4e2a\u529f\u80fd<\/p>\n\n\n\n<ul>\n<li>\u4f2a\u9020\u8bbe\u5907\u4fe1\u606f\uff0c\u5982\u56fe\uff0c\u4f46\u662f\u5b9e\u9645\u4e0a\uff0c\u6211\u5c31\u81ea\u5df1\u7684\u8bbe\u5907\u4fe1\u606f\uff0c\u7136\u540e\u628aFIRST_API_LEVEL\u6539\u4e3a23\uff0c\u914d\u5408\u7b2c\u4e8c\u4e2a\u529f\u80fd\uff0c\u4e5f\u80fd\u9976\u8fc7<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"728\" height=\"124\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-5.png\" alt=\"\" class=\"wp-image-580\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-5.png 728w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-5-300x51.png 300w\" sizes=\"(max-width: 728px) 100vw, 728px\" \/><\/figure>\n\n\n\n<ul>\n<li>UnsupportedOperationException \uff0c\u68c0\u6d4b\u5230DroidGuard\u65f6\u629b\u51fa\u5f02\u5e38\u3002<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"785\" height=\"220\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-6.png\" alt=\"\" class=\"wp-image-581\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-6.png 785w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-6-300x84.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/11\/image-6-768x215.png 768w\" sizes=\"(max-width: 785px) 100vw, 785px\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>https:\/\/github.com\/chiteroman\/PlayIntegrityFix magisk \u7ed5\u8fc7\u63d2\u4ef6<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/developer.android.com\/google\/play\/integrit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[36],"_links":{"self":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts\/565"}],"collection":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=565"}],"version-history":[{"count":4,"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts\/565\/revisions"}],"predecessor-version":[{"id":582,"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts\/565\/revisions\/582"}],"wp:attachment":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=565"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}