{"id":10870,"date":"2022-11-17T17:29:58","date_gmt":"2022-11-17T09:29:58","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=10870"},"modified":"2022-11-17T17:30:11","modified_gmt":"2022-11-17T09:30:11","slug":"oppo%e5%bc%80%e6%94%be%e5%b9%b3%e5%8f%b0-%e5%ba%94%e7%94%a8%e8%af%84%e8%ae%ba%e8%b0%83%e8%b5%b7%e8%83%bd%e5%8a%9b%e6%8e%a5%e5%85%a5%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/10870\/","title":{"rendered":"OPPO\u5f00\u653e\u5e73\u53f0 \u5e94\u7528\u8bc4\u8bba\u8c03\u8d77\u80fd\u529b\u63a5\u5165\u6307\u5357"},"content":{"rendered":"\n<p>OPPO\u5f00\u653e\u5e73\u53f0 \u5e94\u7528\u8bc4\u8bba\u8c03\u8d77\u80fd\u529b\u63a5\u5165\u6307\u5357<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-1\"><strong>\u63a5\u5165\u573a\u666f\u8bf4\u660e<\/strong><\/h2>\n\n\n\n<p>\u63a5\u5165<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/oppo%e8%bd%af%e4%bb%b6\/\" title=\"OPPO\u8f6f\u4ef6\" target=\"_blank\">OPPO\u8f6f\u4ef6<\/a><\/span>\u5546\u5e97\u7684\u8bc4\u8bba\u529f\u80fd\u540e\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728\u672c\u5e94\u7528\u5f53\u524d\u9875\u9762\u8c03\u8d77\u8bc4\u8bba\u7a97\u53e3\uff0c\u8fdb\u884c\u8bc4\u5206\u548c\u8bc4\u8bba\uff0c\u65e0\u987b\u8df3\u8f6c\u81f3\u8f6f\u4ef6\u5546\u5e97\u5185\u3002<br><br>\u6548\u679c\u793a\u4f8b\uff1a<br><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221117172958978.jpg\" alt=\"\u6548\u679c\u793a\u4f8b\u56fe1.jpg\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-2\"><a><\/a><strong>\u529f\u80fd\u4f18\u52bf<\/strong><\/h2>\n\n\n\n<p>1\u3001\u8bc4\u5206\u548c\u8bc4\u8bba\u4f1a\u5f71\u54cd\u60a8\u7684App\u5728\u8f6f\u4ef6\u5546\u5e97\u7684\u6392\u540d\uff0c\u4f18\u8d28\u7684\u8bc4\u8bba\u4ee5\u53ca\u8f83\u9ad8\u7684\u8bc4\u5206\uff0c\u6709\u52a9\u4e8e\u63d0\u5347App\u5728\u5e94\u7528\u5546\u5e97\u7684\u6392\u540d\u3002<br>2\u3001\u4f18\u8d28\u7684\u8bc4\u8bba\u4ee5\u53ca\u8f83\u9ad8\u7684\u8bc4\u5206\uff0c\u6709\u52a9\u4e8e\u6fc0\u53d1\u7528\u6237\u4e0b\u8f7d\u7684\u6b32\u671b\uff0c\u80fd\u6709\u6548\u63d0\u9ad8\u81ea\u7136\u4e0b\u8f7d\u91cf\u3002<br>3\u3001\u4e00\u952e\u8c03\u8d77\u5546\u5e97\u8bc4\u8bba\u9875\u9762\uff0c\u964d\u4f4e\u7528\u6237\u8bc4\u8bba\u6210\u672c\uff0c\u5e2e\u52a9\u60a8\u66f4\u65b9\u4fbf\u9ad8\u6548\u5730\u6536\u96c6\u7528\u6237\u8bc4\u8bba<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-3\"><a><\/a><strong>\u8df3\u8f6c\u534f\u8bae<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>oaps:\/\/mk\/developer\/comment?pkg={callerPkg}\n\u53c2\u6570\u8bf4\u660e\uff1a\npkg:\u8981\u62c9\u8d77\u8bc4\u8bba\u7684\u5e94\u7528\u7684\u5305\u540d\uff0c\u5fc5\u987b\u548c\u8c03\u7528\u5546\u5e97\u7684\u5e94\u7528\u662f\u540c\u4e00\u4e2a\u5305\u540d\uff0c\u5426\u5219\u65e0\u6cd5\u62c9\u8d77\u5546\u5e97\u8bc4\u8bba\u3002\n\u793a\u4f8b(\u6e38\u620f\u4e2d\u5fc3\u62c9\u8d77\u5176\u5728\u5546\u5e97\u7684\u8bc4\u8bba\u9875\u7684\u534f\u8bae\u94fe\u63a5)\uff1a\noaps:\/\/mk\/developer\/comment?pkg=com.nearme.gamecente\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-4\"><a><\/a><strong>\u652f\u6301\u8bc4\u8bba\u7684\u5546\u5e97\u7248\u672c<\/strong><\/h2>\n\n\n\n<p>\u8f6f\u4ef6\u5546\u5e97\u7684\u7248\u672c\u53f7(versionCode) &gt;= 84000\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-5\"><a><\/a><strong>\u8be6\u7ec6\u4f7f\u7528\u65b9\u6cd5<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-6\"><a><\/a><strong>Android R(11) \u5e94\u7528\u5305\u4fe1\u606f\u53ef\u89c1\u6027\u9002\u914d<\/strong><\/h3>\n\n\n\n<p>Android \u4ece R(11) \u5f00\u59cb\u5bf9\u83b7\u53d6\u5e94\u7528\u5305\u4fe1\u606f\u505a\u4e86\u9650\u5236\uff0c\u5b98\u65b9\u9002\u914d\u6587\u6863\u94fe\u63a5<br>1\uff09<a href=\"https:\/\/developer.android.com\/preview\/privacy\/package-visibility#common-interactions\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/developer.android.com\/preview\/privacy\/package-visibility#common-interactions<\/a><\/p>\n\n\n\n<p>2\uff09<a href=\"https:\/\/developer.android.com\/training\/basics\/intents\/package-visibility\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/developer.android.com\/training\/basics\/intents\/package-visibility<\/a><\/p>\n\n\n\n<p>\u517c\u5bb9\u65b9\u6848\uff1a\uff082\u4e2a\u65b9\u5f0f\u4efb\u610f\u9009\u62e9\u4e00\u4e2a\uff0c\u63a8\u8350\u65b9\u6848\u4e00\uff09\u3002<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-7\"><a><\/a><strong>\u65b9\u5f0f\u4e00\uff08\u63a8\u8350\uff09\uff1a<\/strong><\/h4>\n\n\n\n<p>\u5728R\u4e0a \u9700\u8981\u5728manifest\u6dfb\u52a0\u6807\u7b7e\uff08\u8be5\u65b9\u5f0f\uff0c\u53ea\u83b7\u53d6\u8f6f\u4ef6\u5546\u5e97\u4fe1\u606f\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;manifest package=\"com.example.xxxxx\"&gt;\n    ...\n    &lt;queries&gt;\n        &lt;package android:name=\"com.heytap.market\"\/&gt;\n    &lt;\/queries&gt;\n    ...\n&lt;\/manifest&gt;\n\n\n<\/code><\/pre>\n\n\n\n<p>\u8bf4\u660e\uff1a<br>\u6807\u7b7e\u53ef\u80fd\u4f1a\u7f16\u8bd1\u4e0d\u8fc7\uff0c\u51fa\u73b0\u6b64\u95ee\u9898\u8bf7\u5347\u7ea7Android Studio \u548c Gradle \u63d2\u4ef6\uff1a<br>1\uff09<a href=\"https:\/\/developer.android.com\/studio\" target=\"_blank\" rel=\"noreferrer noopener\">Android Studio 3.6.1<\/a>&nbsp;\u6216\u66f4\u9ad8\u7248\u672c<br>2\uff09\u6700\u65b0\u7248\u672c\u7684&nbsp;<a href=\"https:\/\/developer.android.com\/studio\/releases\/gradle-plugin\" target=\"_blank\" rel=\"noreferrer noopener\">Android Gradle<\/a>&nbsp;\u63d2\u4ef6<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-8\"><a><\/a><strong>\u65b9\u5f0f\u4e8c\uff1a<\/strong><\/h4>\n\n\n\n<p>\u5728manifest\u6dfb\u52a0\u4e0b\u7533\u8bf7\u5982\u4e0b\u6743\u9650\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;uses-permission android:name=\"android.permission.QUERY_ALL_PACKAGES\" \/&gt;\n\n<\/code><\/pre>\n\n\n\n<p>\u8bf4\u660e\uff1a<br>\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u540e\u7eedAndroid\u7248\u672c\u53ef\u80fd\u4f1a\u6536\u7d27\u8fd9\u4e2a\u6743\u9650\u7684\u7533\u8bf7\uff0c\u5b58\u5728\u88ab\u7981\u7528\u98ce\u9669\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-9\"><a><\/a><strong>\u4ee3\u7801\u8c03\u7528<\/strong><\/h3>\n\n\n\n<p>\u5f3a\u8c03\uff1a\u4e3a\u4e86\u4f7f\u5546\u5e97\u8bc4\u8bba\u9875\u9762\u6709\u76d6\u5728\u5f53\u524d\u5e94\u7528\u4e4b\u4e0a\u7684\u6548\u679c\uff0c\u5fc5\u987b\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6<br>1\uff09Context \u5fc5\u987b\u4f7f\u7528&nbsp;Activity&nbsp;\u5bf9\u8c61\u3002<br>2\uff09Intent \u4e0d\u80fd\u4f7f\u7528&nbsp;Intent.FLAG_ACTIVITY_NEW_TASK&nbsp;\u8fd9\u4e2aFlag\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    private final static String PKG_MK_HEYTAP = \"com.heytap.market\";\/\/Q\u4e4b\u540e\u7684\u8f6f\u4ef6\u5546\u5e97\u5305\u540d\n    private final static String PKG_MK_OPPO = \"com.oppo.market\";\/\/Q\u4e4b\u524d\u7684\u8f6f\u4ef6\u5546\u5e97\u5305\u540d\n    private final static String COMMENT_DEEPLINK_PREFIX = \"oaps:\/\/mk\/developer\/comment?pkg=\";\n    private final static int SUPPORT_MK_VERSION = 84000; \/\/ \u652f\u6301\u8bc4\u8bba\u529f\u80fd\u7684\u8f6f\u4ef6\u5546\u5e97\u7248\u672c\n\n    \/**\n     * \u62c9\u8d77\u8bc4\u8bba\u9875\u9762\u3002\n     *\/\n    public static boolean jumpToComment(Activity context) {\n        \/\/ \u6b64\u5904\u4e00\u5b9a\u8981\u4f20\u5165\u8c03\u7528\u65b9\u81ea\u5df1\u7684\u5305\u540d\uff0c\u4e0d\u80fd\u7ed9\u5176\u4ed6\u5e94\u7528\u62c9\u8d77\u8bc4\u8bba\u9875\u3002\n        String url = COMMENT_DEEPLINK_PREFIX + context.getPackageName();\n        \/\/ \u4f18\u5148\u5224\u65adheytap\u5305\n        if (getVersionCode(context, PKG_MK_HEYTAP) &gt;= SUPPORT_MK_VERSION) {\n            return jumpApp(context, Uri.parse(url), PKG_MK_HEYTAP);\n        }\n        if (getVersionCode(context, PKG_MK_OPPO) &gt;= SUPPORT_MK_VERSION) {\n            return jumpApp(context, Uri.parse(url), PKG_MK_OPPO);\n        }\n        return false;\n    }\n\n    \/**\n     * \u83b7\u53d6\u76ee\u6807app\u7248\u672c\u53f7~\n     *\n     * @param context\n     * @param packageName\n     * @return \u8fd4\u56de\u7248\u672c\u53f7\n     *\/\n    private static long getVersionCode(Activity context, String packageName) {\n        long versionCode = -1;\n        try {\n            PackageInfo info = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA);\n            if (info != null) {\n                versionCode = Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.P ? info.getLongVersionCode() : info.versionCode;\n            }\n        } catch (PackageManager.NameNotFoundException e) {\n        }\n        return versionCode;\n    }\n\n    private static boolean jumpApp(Activity context, Uri uri, String targetPkgName) {\n        try {\n            Intent intent = new Intent();\n            intent.setAction(Intent.ACTION_VIEW);\n            intent.addCategory(Intent.CATEGORY_DEFAULT);\n            intent.setPackage(targetPkgName);\n            intent.setData(uri);\n            \/\/ \u5efa\u8bae\u91c7\u7528startActivityForResult \u65b9\u6cd5\u542f\u52a8\u5546\u5e97\u9875\u9762\uff0crequestCode\u7531\u8c03\u7528\u65b9\u81ea\u5b9a\u4e49\u4e14\u5fc5\u987b\u5927\u4e8e0\uff0c\u8f6f\u4ef6\u5546\u5e97\u4e0d\u5173\u6ce8\n            context.startActivityForResult(intent, 100);\n            return true;\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n        return false;\n    }\n\n\n<\/code><\/pre>\n\n\n\n<p>\u5efa\u8bae\uff1a<br>1\uff09\u4f7f\u7528Activity\u505a\u4e3acontext\uff0c\u5e76\u4e14\u8c03\u7528Activity.startActivityForResult\u65b9\u6cd5\u62c9\u8d77\u5546\u5e97\uff0c\u8fd9\u6837\u66f4\u5b89\u5168\u3002<br>2\uff09\u5982\u679c\u4f7f\u7528startActivityForResult\u65b9\u6cd5\u62c9\u8d77\u5546\u5e97\uff0crequestCode &gt;0 \u5e76\u4e14 intent \u4e0d\u80fd\u8bbe\u7f6eIntent.FLAG_ACTIVITY_NEW_TASK\u8fd9\u4e2aflag\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u5165OPPO\u8f6f\u4ef6\u5546\u5e97\u7684\u8bc4\u8bba\u529f\u80fd\u540e\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728\u672c\u5e94\u7528\u5f53\u524d\u9875\u9762\u8c03\u8d77\u8bc4\u8bba\u7a97\u53e3\uff0c\u8fdb\u884c\u8bc4\u5206\u548c\u8bc4\u8bba\uff0c\u65e0\u987b\u8df3\u8f6c\u81f3\u8f6f\u4ef6\u5546\u5e97\u5185\u3002<\/p>\n","protected":false},"author":1,"featured_media":10871,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[4900,4898,4155,4896,4899,4897,4886],"special":[65],"attr":[],"class_list":{"0":"post-10870","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-appsj","8":"tag-app","11":"tag-oppo","15":"special-oppokfpt","16":"entry"},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/10870","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/comments?post=10870"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/10870\/revisions"}],"predecessor-version":[{"id":10872,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/10870\/revisions\/10872"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media\/10871"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=10870"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=10870"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=10870"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=10870"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=10870"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}