{"id":15897,"date":"2022-12-22T16:31:49","date_gmt":"2022-12-22T08:31:49","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=15897"},"modified":"2022-12-22T16:31:49","modified_gmt":"2022-12-22T08:31:49","slug":"notify-%e6%9c%ac%e5%9c%b0%e9%80%9a%e7%9f%a5-%e7%a4%ba%e4%be%8b%e5%9b%9b-app%e5%bc%80%e5%8f%91%e5%ae%9e%e7%8e%b0%e6%9c%ac%e5%9c%b0%e6%b6%88%e6%81%af%e9%80%9a%e7%9f%a5%e8%83%bd%e5%8a%9b","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/15897\/","title":{"rendered":"notify\u00a0\u672c\u5730\u901a\u77e5 \u793a\u4f8b\u56db APP\u5f00\u53d1\u5b9e\u73b0\u672c\u5730\u6d88\u606f\u901a\u77e5\u80fd\u529b"},"content":{"rendered":"\n<p>notify\u00a0<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e6%9c%ac%e5%9c%b0%e9%80%9a%e7%9f%a5\/\" title=\"\u672c\u5730\u901a\u77e5\" target=\"_blank\">\u672c\u5730\u901a\u77e5<\/a><\/span> \u793a\u4f8b\u56db APP\u5f00\u53d1\u5b9e\u73b0<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e6%9c%ac%e5%9c%b0%e6%b6%88%e6%81%af\/\" title=\"\u672c\u5730\u6d88\u606f\" target=\"_blank\">\u672c\u5730\u6d88\u606f<\/a><\/span>\u901a\u77e5\u80fd\u529b<\/p>\n\n\n\n<p><strong>\u8bf7\u4ed4\u7ec6\u9605\u8bfb\u672c\u8bf4\u660e\uff1a<\/strong><br>\u2666 \u53d1\u9001\u5ef6\u65f6\uff08interval \u53c2\u6570\u5927\u4e8e 0 \u79d2\uff09\u6216\u5373\u65f6\u672c\u5730\u901a\u77e5\uff1b<br>\u2666 \u53d1\u9001\u540e\u8bf7\u6253\u5f00\u8bbe\u5907\u901a\u77e5\u680f\u67e5\u770b\uff1b<br>\u2666 \u70b9\u51fb\u901a\u77e5\u4f1a\u81ea\u52a8\u6fc0\u6d3bAPP\uff0c\u5982\u63d0\u4f9b\u4e86 url \u53c2\u6570\uff0c\u540c\u65f6\u4f1a\u6253\u5f00\u6b64\u94fe\u63a5\uff08openUrlInApp \u53c2\u6570\u4e3a true \u8868\u793a\u5728App\u5185\u6253\u5f00\uff0c\u5426\u5219\u5728\u7cfb\u7edf\u6d4f\u89c8\u5668\u6253\u5f00\uff09\uff1b<br>\u2666 \u6709\u672a\u8bfb\u901a\u77e5\u7684\u65f6\u5019\uff0c\u684c\u9762APP\u56fe\u6807\u4e00\u822c\u4f1a\u663e\u793a\u6570\u5b57\u89d2\u6807\uff08badge\uff09\uff1b<br>\u2666 \u90e8\u5206 Android \u8bbe\u5907\u9ed8\u8ba4\u662f\u7981\u7528\u901a\u77e5\u7684\uff0c\u53ef\u8c03\u7528 requestAuth \u68c0\u67e5\u662f\u5426\u5141\u8bb8\u901a\u77e5\uff1b<br>\u2666 \u5982\u672a\u5141\u8bb8\u901a\u77e5\uff0c\u53ef\u8c03\u7528 jsBridge.<span class=\"wpcom_keyword_link\"><a href=\"https:\/\/www.yimenapp.com\" target=\"_blank\" title=\"\u5f00\u53d1app\u4ece\u4e00\u95e8\u5f00\u59cb\">app<\/a><\/span>Settings() \u8df3\u8f6c\u5230APP\u8bbe\u7f6e\u754c\u9762\uff0c\u8ba9\u7528\u6237\u5f00\u542f\u901a\u77e5\uff1b<br>\u2666 \u5982\u9700\u663e\u793a\u60ac\u6d6e\u6216\u9501\u5c4f\u901a\u77e5\uff0c\u90e8\u5206\u8bbe\u5907\u53ef\u80fd\u9700\u8981\u4eba\u5de5\u5f00\u542f\u5bf9\u5e94\u6743\u9650\uff1b<br>\u2666 \u5728\u5ef6\u65f6\u7ed3\u675f\u4e4b\u524d\uff08interval \u53c2\u6570\u6307\u5b9a\u7684\uff09\u53ef\u8c03\u7528 cancelAll \u53d6\u6d88\u901a\u77e5\uff0c\u8fd9\u6837\u5c31\u4e0d\u4f1a\u6536\u5230\u8fd8\u6ca1\u53d1\u9001\u7684\u901a\u77e5\u4e86\uff1b<br>\u2666 Android \u7279\u6027\uff1a\u5728 interval \u53c2\u6570\u5ef6\u8fdf\u7ed3\u675f\u4e4b\u95f4\u8981\u786e\u4fddAPP\u8fdb\u7a0b\u5904\u4e8e\u5b58\u6d3b\u72b6\u6001\uff0c\u5426\u5219\u53ef\u80fd\u6536\u4e0d\u5230\u901a\u77e5\uff1b<br>\u2666 iOS \u7279\u6027\uff1a\u5982\u679cAPP\u5904\u4e8e\u524d\u53f0\u6fc0\u6d3b\u72b6\u6001\uff0c\u4ec5\u5f39\u51fa\u901a\u77e5\u63d0\u793a\uff0c\u4e0d\u4f1a\u53d1\u9001\u5230\u901a\u77e5\u680f\uff1b\u5982\u679cAPP\u5904\u4e8e\u540e\u53f0\u3001\u6740\u6b7b\u6216\u9501\u5c4f\u72b6\u6001\uff0c\u4f1a\u53d1\u9001\u5230\u901a\u77e5\u680f\uff1b<\/p>\n\n\n\n<p>\u6838\u5fc3\u4ee3\u7801\u793a\u4f8b\uff0c\u8be6\u60c5\u53c2\u9605demo<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>jsBridge.notification.notify({\n  title  : &quot;\u5988\u5988\u7684\u6d88\u606f&quot;,\n  content: &quot;\u4f60\u5988\u558a\u4f60\u56de\u5bb6\u5403\u996d\u4e86\uff0c\u901f\u56de~~~&quot;\n}, function(succ, data) {\n  if (succ) {\n    console.log(&quot;\u5df2\u53d1\u9001&quot;);\n  } else {\n    alert(JSON.stringify(data));\n  }\n});<\/code><\/pre><\/div>\n\n\n\n<p>A\u6807\u7b7e\u6267\u884cJS\u793a\u4f8b\u4ee3\u7801<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-html\" data-lang=\"HTML\"><code>&lt;a href=&quot;javascript:void(0)&quot; onclick=&quot;zhixing()&quot;&gt;\u6267\u884c&lt;\/a&gt; \n&lt;!-- \u5199\u5165\u4e00\u4e2aA\u6807\u7b7ehref\u503c\u4e3a&quot;javascript:void(0)&quot;\uff0c\u5b9a\u4e49\u70b9\u51fb\u4e8b\u4ef6onclick\uff1b--&gt;\n&lt;script src=&quot;\u60a8\u7684\u670d\u52a1\u5668URL\/jsbridge-mini.js&quot;&gt;&lt;\/script&gt;\n&lt;!-- \u5728\u60a8\u7684\u670d\u52a1\u5668\u5f15\u5165\u4e00\u95e8JS\u5730\u5740\uff0c\u8bf7\u4e0b\u8f7djsbridge-mini.js\u4e0a\u4f20\u60a8\u81ea\u5df1\u7684\u670d\u52a1\u5668\u83b7\u53d6\u94fe\u63a5\uff1b--&gt;\n&lt;script type=&quot;text\/javascript&quot;&gt;\nfunction zhixing() {\n\n\n&lt;!--\u8fd9\u91cc\u53ef\u4ee5\u76f4\u63a5\u590d\u5236JS\u6838\u5fc3\u4ee3\u7801\u5230\u6b64{}\u62ec\u53f7\u5185--&gt;\njsBridge.notification.notify({\n  title  : &quot;\u5988\u5988\u7684\u6d88\u606f&quot;,\n  content: &quot;\u4f60\u5988\u558a\u4f60\u56de\u5bb6\u5403\u996d\u4e86\uff0c\u901f\u56de~~~&quot;\n}, function(succ, data) {\n  if (succ) {\n    console.log(&quot;\u5df2\u53d1\u9001&quot;);\n  } else {\n    alert(JSON.stringify(data));\n  }\n});\n\n}\n&lt;\/script&gt;\n&lt;!--\u6267\u884c\u6838\u5fc3\u4ee3\u7801\uff1b\n\/\/\u5982\u679c\u9700\u8981\u8fdb\u5165\u9875\u9762\u5c31\u6267\u884c\uff0c\u53bb\u6389\u70b9\u51fb\u4e8b\u4ef6\u5373\u53ef\uff1b--&gt;<\/code><\/pre><\/div>\n\n\n\n<p>\u6309\u94ae\u6267\u884cJS\u793a\u4f8b\u4ee3\u7801<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-html\" data-lang=\"HTML\"><code>&lt;button onclick=&quot;zhixing()&quot; &gt;\u6267\u884c&lt;\/button&gt;\n&lt;!-- \/\/\u5199\u4e00\u4e2a\u6309\u94ae\uff0c\u5b9a\u4e49\u70b9\u51fb\u6267\u884c\u4e8b\u4ef6\uff1b --&gt;\n&lt;script src=&quot;\u60a8\u7684\u670d\u52a1\u5668URL\/jsbridge-mini.js&quot;&gt;&lt;\/script&gt;\n&lt;!-- \/\/\u5728\u60a8\u7684\u670d\u52a1\u5668\u5f15\u5165\u4e00\u95e8JS\u5730\u5740\uff0c\u8bf7\u4e0b\u8f7djsbridge-mini.js\u4e0a\u4f20\u60a8\u81ea\u5df1\u7684\u670d\u52a1\u5668\u83b7\u53d6\u94fe\u63a5\uff1b --&gt;\n&lt;script type=&quot;text\/javascript&quot;&gt;\nfunction zhixing() {\n\n\n&lt;!--\u8fd9\u91cc\u53ef\u4ee5\u76f4\u63a5\u590d\u5236JS\u6838\u5fc3\u4ee3\u7801\u5230\u6b64{}\u62ec\u53f7\u5185--&gt;\njsBridge.notification.notify({\n  title  : &quot;\u5988\u5988\u7684\u6d88\u606f&quot;,\n  content: &quot;\u4f60\u5988\u558a\u4f60\u56de\u5bb6\u5403\u996d\u4e86\uff0c\u901f\u56de~~~&quot;\n}, function(succ, data) {\n  if (succ) {\n    console.log(&quot;\u5df2\u53d1\u9001&quot;);\n  } else {\n    alert(JSON.stringify(data));\n  }\n});\n\n}\n&lt;\/script&gt;\n&lt;!-- \/\/\u6267\u884c\u6838\u5fc3\u4ee3\u7801\uff1b\n\/\/\u5982\u679c\u9700\u8981\u8fdb\u5165\u9875\u9762\u5c31\u6267\u884c\uff0c\u53bb\u6389\u70b9\u51fb\u4e8b\u4ef6\u5373\u53ef\uff1b --&gt;<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Android \u7279\u6027\uff1a\u5728 interval \u53c2\u6570\u5ef6\u8fdf\u7ed3\u675f\u4e4b\u95f4\u8981\u786e\u4fddAPP\u8fdb\u7a0b\u5904\u4e8e\u5b58\u6d3b\u72b6\u6001\uff0c\u5426\u5219\u53ef\u80fd\u6536\u4e0d\u5230\u901a\u77e5<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[698],"tags":[7412,1666,5213,7414,1718],"special":[],"attr":[],"class_list":{"0":"post-15897","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-app84","7":"tag-app","10":"tag-7414","11":"tag-1718","12":"entry"},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/15897","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=15897"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/15897\/revisions"}],"predecessor-version":[{"id":15898,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/15897\/revisions\/15898"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=15897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=15897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=15897"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=15897"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=15897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}