{"id":208336,"date":"2025-07-08T12:47:02","date_gmt":"2025-07-08T04:47:02","guid":{"rendered":"https:\/\/server.hk\/cnblog\/208336\/"},"modified":"2025-07-08T12:47:02","modified_gmt":"2025-07-08T04:47:02","slug":"%e5%9c%a8-firebase-admin-go-%e5%ae%a2%e6%88%b7%e7%ab%af%e4%b8%ad%e8%ae%be%e7%bd%ae-notification_priority","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/208336\/","title":{"rendered":"\u5728 firebase admin go \u5ba2\u6237\u7aef\u4e2d\u8bbe\u7f6e notification_priority"},"content":{"rendered":"<p><b><\/b> <\/p>\n<p>\u5f53\u524d\u4f4d\u7f6e\uff1a <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>\u5728 firebase admin go \u5ba2\u6237\u7aef\u4e2d\u8bbe\u7f6e notification_priority<\/span><\/p>\n<p><span>\u6765\u6e90\uff1astackoverflow<\/span><br \/>\n<span>2024-05-01 22:12:37<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u77e5\u8bc6\u70b9\u638c\u63e1\u4e86\uff0c\u8fd8\u9700\u8981\u4e0d\u65ad\u7ec3\u4e60\u624d\u80fd\u719f\u7ec3\u8fd0\u7528\u3002\u4e0b\u9762\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u4e2aGolang\u5f00\u53d1\u5b9e\u6218\uff0c\u624b\u628a\u624b\u6559\u5927\u5bb6\u5b66\u4e60\u300a\u5728 firebase admin go \u5ba2\u6237\u7aef\u4e2d\u8bbe\u7f6e notification_priority\u300b\uff0c\u5728\u5b9e\u73b0\u529f\u80fd\u7684\u8fc7\u7a0b\u4e2d\u4e5f\u5e26\u5927\u5bb6\u91cd\u65b0\u6e29\u4e60\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6e29\u6545\u800c\u77e5\u65b0\uff0c\u56de\u5934\u770b\u770b\u8bf4\u4e0d\u5b9a\u53c8\u6709\u4e0d\u4e00\u6837\u7684\u611f\u609f\uff01<\/p>\n<p> \u95ee\u9898\u5185\u5bb9<br \/>\n <\/p>\n<p>\u6839\u636e firebase \u6587\u6863\uff0c\u6211\u4eec\u53ef\u4ee5\u8bbe\u7f6e\u53c2\u6570 <strong>notification_priority<\/strong> \u6765\u786e\u5b9a\u6d88\u606f\u4f18\u5148\u7ea7\u3002<\/p>\n<p>https:\/\/firebase.google.com\/docs\/reference\/fcm\/rest\/v1\/projects.messages#androidnotification<\/p>\n<pre>{\n  \"title\": string,\n  \"body\": string,\n  \"icon\": string,\n  \"color\": string,\n  \"sound\": string,\n  \"tag\": string,\n  \"click_action\": string,\n  \"body_loc_key\": string,\n  \"body_loc_args\": [\n    string\n  ],\n  \"title_loc_key\": string,\n  \"title_loc_args\": [\n    string\n  ],\n  \"channel_id\": string,\n  \"ticker\": string,\n  \"sticky\": boolean,\n  \"event_time\": string,\n  \"local_only\": boolean,\n  \"notification_priority\": enum (notificationpriority),<\/pre>\n<p>\u6211\u6b63\u5728\u5c1d\u8bd5\u4f7f\u7528 firebase admin go \u5ba2\u6237\u7aef\uff0c\u4f46\u662f\u5f53\u6211\u770b\u5230\u6d88\u606f\u7ed3\u6784\u65f6\uff0c\u6211\u770b\u4e0d\u5230\u8be5\u5143\u7d20 <\/p>\n<p>\u7ed3\u6784\u4f53\u5b9a\u4e49\u5982\u4e0b\uff1a https:\/\/godoc.org\/firebase.google.com\/go\/messaging#androidnotification<\/p>\n<pre>type androidnotification struct {\n    title        string   `json:\"title,omitempty\"` \/\/ if specified, overrides the title field of the notification type\n    body         string   `json:\"body,omitempty\"`  \/\/ if specified, overrides the body field of the notification type\n    icon         string   `json:\"icon,omitempty\"`\n    color        string   `json:\"color,omitempty\"` \/\/ notification color in #rrggbb format\n    sound        string   `json:\"sound,omitempty\"`\n    tag          string   `json:\"tag,omitempty\"`\n    clickaction  string   `json:\"click_action,omitempty\"`\n    bodylockey   string   `json:\"body_loc_key,omitempty\"`\n    bodylocargs  []string `json:\"body_loc_args,omitempty\"`\n    titlelockey  string   `json:\"title_loc_key,omitempty\"`\n    titlelocargs []string `json:\"title_loc_args,omitempty\"`\n    channelid    string   `json:\"channel_id,omitempty\"`\n    imageurl     string   `json:\"image,omitempty\"`\n}<\/pre>\n<p>firebase \u6587\u6863\u548c\u7ed3\u6784\u662f\u5426\u5b58\u5728\u5dee\u5f02\uff0c\u6216\u8005\u6211\u662f\u5426\u9057\u6f0f\u4e86\u67d0\u4e9b\u5185\u5bb9\uff1f \u95ee\u9898\u662f\uff0c\u5982\u679c\u8bbe\u5907\u5904\u4e8e\u7761\u7720\u72b6\u6001\uff0c\u6d88\u606f\u4f1a\u53d1\u9001\u5230\u8bbe\u5907\uff0c\u4f46\u6ca1\u6709\u58f0\u97f3\u6216\u5c4f\u5e55\u663e\u793a\u3002 \uff08\u4e00\u52a07 pro\u4e0a\u51fa\u73b0\uff0c\u53ea\u662f\u5076\u5c14\u51fa\u73b0\uff09<\/p>\n<p>\u6211\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u4e86\u4e8b\u4ef6<\/p>\n<pre>1.  Dial *#*#426#*#* to open the FCM Diagnostics page.\n   2.  Tap the EVENTS button to show the event log.\n   3.  Check whether the message was delivered to the device. There should be a log entry reading<\/pre>\n<p>\u770b\u5230 youtube \u6d88\u606f\u7684\u4f18\u5148\u7ea7\u4e3a<strong>\u9ad8<\/strong>\uff0c\u800c\u6211\u7684\u6d88\u606f\u7684\u4f18\u5148\u7ea7\u663e\u793a\u4e3a<strong>\u672a\u77e5<\/strong>\u3002<\/p>\n<p>\u5982\u4f55\u6309\u7167\u6587\u6863\u4e2d\u7684\u63cf\u8ff0\u53d1\u9001\u9ad8\u4f18\u5148\u7ea7\u6d88\u606f\uff1f<\/p>\n<p> <\/p>\n<h2>\u89e3\u51b3\u65b9\u6848<\/h2>\n<p> <\/p>\n<p>\u6765\u81ea <code>notification_priority<\/code> \u7684\u6587\u6863\uff1a<\/p>\n<p>\u8bbe\u7f6e\u6b64\u901a\u77e5\u7684\u76f8\u5bf9\u4f18\u5148\u7ea7\u3002\u4f18\u5148\u7ea7\u6307\u793a\u8be5\u901a\u77e5\u5e94\u6d88\u8017\u591a\u5c11\u7528\u6237\u7684\u6ce8\u610f\u529b\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f4e\u4f18\u5148\u7ea7\u901a\u77e5\u53ef\u80fd\u5bf9\u7528\u6237\u9690\u85cf\uff0c\u800c\u7528\u6237\u53ef\u80fd\u4f1a\u56e0\u9ad8\u4f18\u5148\u7ea7\u901a\u77e5\u800c\u88ab\u6253\u65ad\u3002\u8bbe\u7f6e\u76f8\u540c\u4f18\u5148\u7ea7\u7684\u6548\u679c\u5728\u4e0d\u540c\u5e73\u53f0\u4e0a\u53ef\u80fd\u4f1a\u7565\u6709\u4e0d\u540c\u3002\u8bf7\u6ce8\u610f\uff0c\u6b64\u4f18\u5148\u7ea7\u4e0e AndroidMessagePriority \u4e0d\u540c\u3002\u6b64\u4f18\u5148\u7ea7\u5728\u6d88\u606f\u4f20\u9012\u540e\u7531\u5ba2\u6237\u7aef\u5904\u7406\uff0c\u800c AndroidMessagePriority \u662f\u4e00\u4e2a FCM \u6982\u5ff5\uff0c\u7528\u4e8e\u63a7\u5236\u6d88\u606f\u4f55\u65f6\u4f20\u9012\u3002<\/p>\n<p>Go SDK \u76ee\u524d\u6682\u4e0d\u652f\u6301\u8be5\u53c2\u6570\u3002\u8bf7\u968f\u65f6\u5728 GitHub \u5b58\u50a8\u5e93\u4e2d\u63d0\u51fa\u529f\u80fd\u8bf7\u6c42\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300a\u5728 firebase admin go \u5ba2\u6237\u7aef\u4e2d\u8bbe\u7f6e notification_priority\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4f4d\u7f6e\uff1a &gt; &gt; &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-208336","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/208336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=208336"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/208336\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=208336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=208336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=208336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}