{"id":12255,"date":"2022-11-24T11:46:37","date_gmt":"2022-11-24T03:46:37","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=12255"},"modified":"2022-11-24T11:46:39","modified_gmt":"2022-11-24T03:46:39","slug":"%e5%b0%8f%e7%b1%b3miui-10-%e9%80%9a%e7%9f%a5%e7%b1%bb%e5%88%ab-channel-%e9%80%82%e9%85%8d%e8%af%b4%e6%98%8e","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/12255\/","title":{"rendered":"\u5c0f\u7c73MIUI 10 \u901a\u77e5\u7c7b\u522b (Channel) \u9002\u914d\u8bf4\u660e"},"content":{"rendered":"\n<p>\u5c0f\u7c73<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/miui-10\/\" title=\"MIUI 10\" target=\"_blank\">MIUI 10<\/a><\/span> \u901a\u77e5\u7c7b\u522b (<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/channel\/\" title=\"Channel\" target=\"_blank\">Channel<\/a><\/span>) \u9002\u914d\u8bf4\u660e<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_0\">1. \u4ec0\u4e48\u662f\u901a\u77e5\u7c7b\u522b \/ Channel<\/h2>\n\n\n\n<p>\u901a\u77e5\u7c7b\u522b (channel) \u662f <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/android-o\/\" title=\"Android O\" target=\"_blank\">Android O<\/a><\/span> \u5f15\u5165\u7684\u65b0\u529f\u80fd\uff0c\u65e8\u5728\u89e3\u51b3\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5e94\u7528\u7684\u901a\u77e5\u8d8a\u6765\u8d8a\u591a\uff0c\u7ed9\u7528\u6237\u9020\u6210\u660e\u663e\u6253\u6270\u3002<\/li><li>\u4f46\u7528\u6237\u53ea\u80fd\u5168\u5c40\u5c4f\u853d\u8fd9\u4e2a\u5e94\u7528\u7684\u5168\u90e8\u901a\u77e5\uff0c\u4e0d\u80fd\u5c4f\u853d\u90e8\u5206\uff0c\u7136\u540e\u7559\u4e0b\u5bf9\u81ea\u5df1\u6709\u7528\u7684\u3002<\/li><\/ul>\n\n\n\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0cAndroid \u8981\u6c42\u5f00\u53d1\u8005\u7ed9\u81ea\u5df1\u7684\u901a\u77e5\u5206\u6210\u82e5\u5e72\u7c7b\uff0c\u7136\u540e\u5141\u8bb8\u7528\u6237<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e5%8d%95%e7%8b%ac%e5%b1%8f%e8%94%bd\/\" title=\"\u5355\u72ec\u5c4f\u853d\" target=\"_blank\">\u5355\u72ec\u5c4f\u853d<\/a><\/span>\u8fd9\u4e2a\u7c7b\u522b\u7684\u901a\u77e5\u3002\u4ee5<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e7%88%b1%e5%a5%87%e8%89%ba\/\" title=\"\u7231\u5947\u827a\" target=\"_blank\">\u7231\u5947\u827a<\/a><\/span>(v9.5.0) \u4e3a\u4f8b\uff0c\u5c06\u901a\u77e5\u5206\u6210\u4e86 4 \u79cd Channel\uff0c3 \u4e2a <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/channel-group\/\" title=\"Channel Group\" target=\"_blank\">Channel Group<\/a><\/span>\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114637787.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u7b80\u5355\u89e3\u91ca\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Channel\uff1a\u5b9e\u9645\u7684\u901a\u77e5\u7c7b\u522b\uff0c\u7231\u5947\u827a\u5206\u6210\u4e864\u7c7b\u901a\u77e5\u3002<\/li><li>Channel Group\uff1a\u4e00\u7ec4 channel\uff0c\u4ec5\u7528\u4e8e\u505a\u5206\u7ec4\u533a\u5206\uff0c\u6ca1\u6709\u66f4\u591a\u7684\u903b\u8f91\u3002<\/li><li>\u6bcf\u4e2a\u901a\u77e5\u7c7b\u522b\u7684\u6743\u9650\u4e92\u76f8\u72ec\u7acb\uff0c\u4e92\u4e0d\u5f71\u54cd\u3002\u4f8b\u5982\uff0c\u901a\u77e5\u5c4f\u853d\u4e86\u7231\u5947\u827a\u7684\u300c\u65b0\u7fa4\u804a\u6d88\u606f\u300d\u7c7b\u901a\u77e5\uff0c\u300c\u5e38\u89c4\u63a8\u9001\u300d\u7c7b\u901a\u77e5\u4f9d\u7136\u53ef\u4ee5\u53d1\u51fa\u6765\u3002<\/li><\/ul>\n\n\n\n<p>Android \u5df2\u5c06 Channel \u7684\u903b\u8f91\u7eb3\u5165 <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/android-compatibility\/\" title=\"Android Compatibility\" target=\"_blank\">Android Compatibility<\/a><\/span> Definition Document (CDD) \u4e2d\uff0c\u610f\u5473\u7740\u6240\u6709 Android \u5382\u5546\u90fd\u5fc5\u987b\u652f\u6301\u3002\u56e0\u6b64 MIUI 10 \u4e5f\u5c06\u517c\u5bb9\u548c\u652f\u6301\u76f8\u5173\u903b\u8f91\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_1\">2.\u5982\u4f55\u9002\u914d\u901a\u77e5\u7c7b\u522b(Channel)<\/h2>\n\n\n\n<p>\u5b98\u65b9\u6587\u6863\u5df2\u6709\u975e\u5e38\u8be6\u7ec6\u7684\u63cf\u8ff0\uff0c\u9002\u914d\u6b65\u9aa4\u4e0d\u518d\u8d58\u8ff0\uff0c\u8be6\u89c1&nbsp;<a href=\"https:\/\/developer.android.com\/training\/notify-user\/channels\">https:\/\/developer.android.com\/training\/notify-user\/channels<\/a>&nbsp;\u3002<\/p>\n\n\n\n<p>\u6709\u51e0\u70b9\u503c\u5f97\u6ce8\u610f\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_0\">2.1. \u4e0d\u8981\u6ee5\u8bbe\u7c7b\u522b\uff0c\u5efa\u8bae\u63a7\u5236\u5728 7 \u7c7b\u4ee5\u5185<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_1\">2.2. Channel \u7684\u540d\u5b57\u8981\u6709\u53ef\u8bfb\u6027\u3001\u6709\u5177\u4f53\u542b\u4e49\uff0c\u540c\u65f6\u907f\u514d\u540d\u5b57\u91cd\u590d<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114638852.png\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_2\">2.3. \u5982\u679c Channel \u540d\u5b57\u4e0d\u597d\u7406\u89e3\uff0c\u53ef\u4ee5\u4f7f\u7528&nbsp;<code><a href=\"https:\/\/developer.android.com\/reference\/android\/app\/NotificationChannel.html#setDescription(java.lang.String)\">setDescription<\/a><\/code>&nbsp;\u6765\u8865\u5145\u8bf4\u660e Channel \u7684\u542b\u4e49<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114638923.png\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_3\">2.4. \u6700\u597d\u4e0d\u8981\u53ea\u8bbe\u4e00\u4e2a Channel\uff0c\u90a3\u6837\u5c31\u6ca1\u6709\u8bbe\u7f6e Channel \u7684\u610f\u4e49\u4e86\u3002\u4ee5\u732b\u773c\u4e3a\u4f8b\uff0c\u53ef\u4ee5\u8003\u8651\u5c06\u901a\u77e5\u62c6\u6210\u591a\u4e2a Channel\uff0c\u5982\u4e0b\u56fe<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114638579.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_2\">3. FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_2_0\">3.1. \u4e00\u5b9a\u8981\u9002\u914d\u901a\u77e5 Channel \u5417<\/h3>\n\n\n\n<p>\u53d6\u51b3\u4e8e\u4f60\u7684\u5e94\u7528\u7684 target API\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>target API \u2265 26(Android 8.0)\uff1a\u5fc5\u987b\u9002\u914d\uff0c\u800c\u4e14\u5fc5\u987b\u7ed9\u6bcf\u6761\u901a\u77e5\u6307\u5b9a\u4e00\u4e2a Channel\uff0c\u5426\u5219\u65e0\u6cd5\u53d1\u51fa\u901a\u77e5\u3002<\/li><li>target API \u2264 25(Android 7.1)\uff1a\u53ef\u4ee5\u4e0d\u9002\u914d\u3002\u57288.0\u53ca\u4ee5\u4e0a\u7684\u8bbe\u5907\uff0c\u901a\u77e5\u4e5f\u80fd\u6b63\u5e38\u53d1\u51fa\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_2_1\">3.2. \u4e00\u5b9a\u8981\u6709\u901a\u77e5 Channel Group \u5417<\/h3>\n\n\n\n<p>\u4e0d\u662f\u5fc5\u987b\u7684\u3002\u6ca1\u5fc5\u8981\u5f3a\u884c\u8bbe\u7f6e Channel Group\uff0c\u5e94\u8be5\u89c6\u81ea\u5df1\u7684\u4e1a\u52a1\u9700\u6c42\u800c\u5b9a\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_2_2\">3.3. \u9002\u914d Channel \u540e\uff0c\u5728 Android 8.0 \u4ee5\u524d\u7684\u8bbe\u5907\u4f1a\u600e\u4e48\u8868\u73b0<\/h3>\n\n\n\n<p>Android 8.0 \u4ee5\u524d\u7684\u8bbe\u5907\uff0c\u4f1a\u5b8c\u5168\u65e0\u89c6\u8fd9\u4e2a\u529f\u80fd\uff0c\u56e0\u6b64\u4e0d\u4f1a\u5e26\u6765\u4efb\u4f55\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_2_3\">3.4. \u521b\u5efa\u597d Channel \u540e\uff0c\u5728\u4ee3\u7801\u91cc\u4fee\u6539\u5176\u914d\u7f6e\uff0c\u4e3a\u4ec0\u4e48\u4f1a\u4e0d\u751f\u6548<\/h3>\n\n\n\n<p>\u8fd9\u4e2a\u662f Android \u5bf9\u6b64\u529f\u80fd\u589e\u52a0\u7684\u9650\u5236\uff1a\u5f53 Channel \u5df2\u7ecf\u5b58\u5728\u65f6\uff0c\u540e\u9762\u7684&nbsp;createNotificationChannel&nbsp;\u65b9\u6cd5\u4ec5\u80fd\u66f4\u65b0\u5176&nbsp;name\/description\uff0c\u4ee5\u53ca\u5bf9&nbsp;importance&nbsp;\u8fdb\u884c\u964d\u7ea7\uff0c\u5176\u4f59\u914d\u7f6e\u5747\u65e0\u6cd5\u66f4\u65b0\u3002\u5148<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/NotificationManager#deletenotificationchannel\">\u5220\u9664\u65e7\u7684 Channel<\/a>\uff0c\u518d\u521b\u5efa\u65b0\u7684 Channel \u4e5f\u65e0\u6cd5\u5b9e\u73b0\u5bf9\u5176&nbsp;importance&nbsp;\u7684\u5347\u7ea7\u3002<\/p>\n\n\n\n<p>\u76f8\u5173\u903b\u8f91\u5728&nbsp;com\/android\/server\/notificaton\/RankingHelper.java\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Override\n<strong>public<\/strong> <strong>void<\/strong> <strong>createNotificationChannel<\/strong>(String pkg, <strong>int<\/strong> uid, NotificationChannel channel,\n        <strong>boolean<\/strong> fromTargetApp) {\n<em>\/\/......<\/em>\n    NotificationChannel existing = r.channels.get(channel.getId());\n    <em>\/\/ Keep most of the existing settings<\/em>\n    <strong>if<\/strong> (existing != <strong>null<\/strong> &amp;&amp; fromTargetApp) { <em>\/\/ \u5982\u679c\u5df2\u7ecf\u5b58\u5728\u540cchannel-id\u7684Channel<\/em>\n<em>\/\/......<\/em>\n        existing.setName(channel.getName().toString()); <em>\/\/ \u5219\u66f4\u65b0name\u548cdescription<\/em>\n        existing.setDescription(channel.getDescription());\n        existing.setBlockableSystem(channel.isBlockableSystem());\n \n        <em>\/\/ Apps are allowed to downgrade channel importance if the user has not changed any<\/em>\n        <em>\/\/ fields on this channel yet.<\/em>\n        <strong>if<\/strong> (existing.getUserLockedFields() == 0 &amp;&amp;  <em>\/\/ \u5e76\u4e14\u4ec5\u5f53\u66f4\u65b0\u7684importance\u5c0f\u4e8e\u539f\u6765\u8bbe\u7f6e\u7684\u503c\u65f6\u624d\u66f4\u65b0importance<\/em>\n                channel.getImportance() &lt; existing.getImportance()) {\n            existing.setImportance(channel.getImportance());\n        }\n \n        updateConfig();\n        <strong>return<\/strong>;\n    }\n<em>\/\/......<\/em>\n}\n\n\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_2_4\">3.5. \u5982\u4f55\u5224\u65ad MIUI \u7248\u672c<\/h3>\n\n\n\n<p>\u6709\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android.os.SystemProperties.<strong>get<\/strong>(\"ro.miui.ui.version.code\",&nbsp;\"7\");<em>\/\/ \u5982\u679c\u8fd4\u56de\u503c\u662f\u300c8\u300d\uff0c\u5c31\u662f MIUI 10<\/em><\/code><\/pre>\n\n\n\n<p>\u6216<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android.os.SystemProperties.<strong>get<\/strong>(\"ro.miui.ui.version.name\",&nbsp;\"\");<em>\/\/ \u5982\u679c\u8fd4\u56de\u503c\u662f\u300cV10\u300d\uff0c\u5c31\u662f MIUI 10<\/em><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_2_5\">3.6. \u5982\u4f55\u6d4b\u8bd5<\/h3>\n\n\n\n<p>\u5347\u7ea7\u5230&nbsp; MIUI 10 \u6700\u65b0\u5f00\u53d1\u7248\u5373\u53ef\uff0c\u652f\u6301\u7684\u673a\u578b\u548c\u4e0b\u8f7d\u94fe\u63a5\u5982\u4e0b\uff08\u627e\u5230\u5bf9\u5e94\u673a\u578b\u7684\u6700\u65b0\u5f00\u53d1\u7248\uff09\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u56fd\u5185\u7248 ROM\uff1a<a href=\"https:\/\/www.miui.com\/download.html\">https:\/\/www.miui.com\/download.html<\/a><\/li><li>\u56fd\u9645\u7248 ROM\uff1a<a href=\"http:\/\/en.miui.com\/download.html\">http:\/\/en.miui.com\/download.html<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u77e5\u7c7b\u522b (channel) \u662f Android O \u5f15\u5165\u7684\u65b0\u529f\u80fd\uff0c\u65e8\u5728\u89e3\u51b3\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n","protected":false},"author":1,"featured_media":12256,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46,94,160],"tags":[5740,5736,5243,5737,5722,5739,5738],"special":[66],"attr":[],"class_list":["post-12255","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-appsj","category-appjc","category-appcs","tag-android-compatibility","tag-android-o","tag-channel","tag-channel-group","tag-miui-10","tag-5739","tag-5738","special-vivokfpt","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/12255","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=12255"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/12255\/revisions"}],"predecessor-version":[{"id":12260,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/12255\/revisions\/12260"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media\/12256"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=12255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=12255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=12255"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=12255"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=12255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}