{"id":910,"date":"2015-07-23T11:36:07","date_gmt":"2015-07-23T03:36:07","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=910"},"modified":"2026-08-18T12:58:43","modified_gmt":"2026-08-18T04:58:43","slug":"android%e9%80%9a%e7%9f%a5notification","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=910","title":{"rendered":"Android\u901a\u77e5Notification"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\"><strong>Notification<\/strong> \u662f\u5728 App \u5e38\u89c4 UI \u4e4b\u5916\u63d0\u793a\u4e8b\u4ef6\u7684\u4ea4\u4e92\uff1a\u7528\u6237\u53ef\u4ee5\u5728\u7528\u522b\u7684 app \u65f6\u770b\u5230\u901a\u77e5\uff0c\u65b9\u4fbf\u65f6\u518d\u70b9\u8fdb\u53bb\u3002\u4e0b\u9762\u8986\u76d6 Builder \u53d1\u5e03\u3001\u66f4\u65b0\u4e0e\u79fb\u9664\u3001\u4ece\u901a\u77e5\u542f\u52a8 Activity \u65f6\u4fdd\u7559\u8fd4\u56de\u6808\u3001\u8fdb\u5ea6\u6761\u901a\u77e5\uff0c\u4ee5\u53ca RemoteViews \u81ea\u5b9a\u4e49\u754c\u9762\u3002<\/p>\n<\/blockquote>\n<p><!--more--><\/p>\n<hr>\n<p style=\"margin: 1em 0px;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-914\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/QQ\u255c\u256a\u2550\u255d20150723114003.png\" alt=\"QQ\u255c\u256a\u2550\u255d20150723114003\" width=\"349\" height=\"62\" \/><\/p>\n<p style=\"margin: 1em 0px;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-915\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/QQ\u255c\u256a\u2550\u255d20150723113938.png\" alt=\"QQ\u255c\u256a\u2550\u255d20150723113938\" width=\"348\" height=\"106\" \/><\/p>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e00\u3001\u5efa\u7acb\u4e00\u4e2a Notification<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">NotificationCompat.Builder<\/code> \u8bbe UI \u7279\u5f81\u548c\u884c\u4e3a\uff0c\u518d <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">notify(id, notification)<\/code> \u53d1\u5e03\u3002notificationId \u552f\u4e00\u6807\u8bc6\u8fd9\u6761\u901a\u77e5\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">NotificationCompat.Builder builder = new NotificationCompat.Builder(this);\nbuilder.setSmallIcon(R.drawable.m4);\nbuilder.setContentTitle(\"\u901a\u77e5\u6807\u9898\");\nbuilder.setContentText(\"1\u6761\u65b0\u6d88\u606f\");\nbuilder.setTicker(\"\u6536\u52301\u6761\u65b0\u6d88\u606f\");\nbuilder.setNumber(1);\nbuilder.setAutoCancel(true);\nbuilder.setDefaults(Notification.DEFAULT_ALL); \/\/ requires VIBRATE permission\nbuilder.setWhen(System.currentTimeMillis());\nbuilder.setSound(uri);\n\nIntent intent = new Intent(this, BaseActivity.class);\nPendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);\nbuilder.setContentIntent(pendingIntent);\n\nNotificationManager mNotifyManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\nNotification notification = builder.build();\nint notificationId = 10;\nmNotifyManager.notify(notificationId, notification);<\/code><\/pre>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">PendingIntent<\/code> \u5b57\u9762\u662f\u300c\u7b49\u5f85\u7684\u3001\u672a\u51b3\u5b9a\u7684 Intent\u300d\u3002\u9759\u6001\u5de5\u5382 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">getActivity<\/code> \/ <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">getBroadcast<\/code> \/ <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">getService<\/code> \u5206\u522b\u5bf9\u5e94\u8df3 Activity\u3001\u5f00\u5e7f\u64ad\u3001\u5f00\u670d\u52a1\uff0c\u90fd\u5fc5\u987b\u4f20\u5165 Intent \u548c Context\u3002<\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e8c\u3001\u66f4\u65b0\u4e0e\u79fb\u9664<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u53d1\u5e03\u65f6\u7528\u56fa\u5b9a ID\uff1a<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">notify(ID, notification)<\/code>\u3002\u4e4b\u540e\u6539 Builder \u518d <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">build()<\/code>\uff0c\u7528<strong>\u540c\u4e00\u4e2a ID<\/strong> \u53d1\u5e03\u5373\u66f4\u65b0\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u79fb\u9664\uff1a\u521b\u5efa\u65f6 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setAutoCancel(true)<\/code>\uff0c\u70b9\u51fb\u5373\u6d88\u5931\uff1b\u6216 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">cancel(notificationId)<\/code> \/ <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">cancelAll()<\/code>\u3002<\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e09\u3001\u4ece\u901a\u77e5\u542f\u52a8\u65f6\u4fdd\u7559\u5bfc\u822a<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u901a\u77e5\u6253\u5f00\u7684\u662f\u5de5\u4f5c\u6d41\u4e2d\u7684\u67d0\u4e2a Activity \u65f6\uff0c\u8981\u5728 manifest \u58f0\u660e\u5c42\u6b21\uff0c\u518d\u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">TaskStackBuilder<\/code> \u7ec4\u8fd4\u56de\u6808\u3002<\/p>\n<p style=\"margin: 1em 0px;\">1. Manifest \u5c42\u6b21\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">&lt;activity\n    android:name=\".MainActivity\"\n    android:label=\"@string\/app_name\" &gt;\n    &lt;intent-filter&gt;\n        &lt;action android:name=\"android.intent.action.MAIN\" \/&gt;\n        &lt;category android:name=\"android.intent.category.LAUNCHER\" \/&gt;\n    &lt;\/intent-filter&gt;\n&lt;\/activity&gt;\n&lt;activity\n    android:name=\".ResultActivity\"\n    android:parentActivityName=\".MainActivity\"&gt;\n    &lt;meta-data\n        android:name=\"android.support.PARENT_ACTIVITY\"\n        android:value=\".MainActivity\"\/&gt;\n&lt;\/activity&gt;<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">2. \u4e3a\u542f\u52a8 Intent \u521b\u5efa\u8fd4\u56de\u6808\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">int id = 1;\nIntent resultIntent = new Intent(this, ResultActivity.class);\nTaskStackBuilder stackBuilder = TaskStackBuilder.create(this);\nstackBuilder.addParentStack(ResultActivity.class);\nstackBuilder.addNextIntent(resultIntent);\nPendingIntent resultPendingIntent =\n        stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);\n\nNotificationCompat.Builder builder = new NotificationCompat.Builder(this);\nbuilder.setContentIntent(resultPendingIntent);\nNotificationManager mNotificationManager =\n        (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);\nmNotificationManager.notify(id, builder.build());<\/code><\/pre>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u56db\u3001\u5728\u901a\u77e5\u91cc\u5c55\u793a\u8fdb\u5ea6<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u786e\u5b9a\u8fdb\u5ea6\uff1a<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setProgress(max, progress, false)<\/code>\uff1b\u4e0d\u786e\u5b9a\u5219\u7b2c\u4e09\u4e2a\u53c2\u6570\u4e3a true\u3002\u5b8c\u6210\u65f6 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setProgress(0, 0, false)<\/code> \u53bb\u6389\u8fdb\u5ea6\u6761\u3002\u8fdb\u5ea6\u53d8\u5316\u8981\u4e0d\u65ad\u6539 progress \u5e76\u518d\u6b21 notify\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">int id = 1;\nmNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);\nmBuilder = new NotificationCompat.Builder(this);\nmBuilder.setContentTitle(\"Picture Download\")\n    .setContentText(\"Download in progress\")\n    .setSmallIcon(R.drawable.ic_notification);\nnew Thread(new Runnable() {\n    @Override\n    public void run() {\n        int incr;\n        for (incr = 0; incr &lt;= 100; incr+=5) {\n            mBuilder.setProgress(100, incr, false);\n            mNotifyManager.notify(id, mBuilder.build());\n            try {\n                Thread.sleep(5*1000);\n            } catch (InterruptedException e) {\n                Log.d(TAG, \"sleep failure\");\n            }\n        }\n        mBuilder.setContentText(\"Download complete\")\n                .setProgress(0,0,false);\n        mNotifyManager.notify(id, mBuilder.build());\n    }\n}).start();<\/code><\/pre>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/pregress_notifiy.jpeg\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-911\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/pregress_notifiy.jpeg\" alt=\"pregress_notifiy\" width=\"518\" height=\"84\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/progress_notification2.jpeg\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-912\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/progress_notification2.jpeg\" alt=\"progress_notification2\" width=\"300\" height=\"99\" \/><\/a><\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e94\u3001\u81ea\u5b9a\u4e49 Notification \u754c\u9762<\/span><\/h2>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">RemoteViews<\/code> \u94fa\u81ea\u5b9a\u4e49\u5e03\u5c40\uff0c<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setOnClickPendingIntent<\/code> \u7ed1\u70b9\u51fb\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);\nmBuilder.setSmallIcon(R.drawable.m8);\nmBuilder.setTicker(\"\u81ea\u5b9a\u4e49\u901a\u77e5\uff0c\u4f60\u6709\u65b0\u6d88\u606f\");\nmBuilder.setAutoCancel(true);\n\nRemoteViews view = new RemoteViews(getPackageName(), R.layout.view_notificaction_layout);\nmBuilder.setContent(view);\n\nIntent intent = new Intent(this, RadioTabActivity.class);\nPendingIntent pendingIntent = PendingIntent.getActivity(this, 01, intent, PendingIntent.FLAG_UPDATE_CURRENT);\nview.setOnClickPendingIntent(R.id.player_notification, pendingIntent);\n\nNotification notification = mBuilder.build();\nint notificationId = 29;\nNotificationManager mNotifyManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\nmNotifyManager.notify(notificationId, notification);<\/code><\/pre>\n<table style=\"border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; text-align: left; overflow: auto; display: table; overflow-wrap: break-word; word-break: break-all;\" width=\"817\">\n<thead>\n<tr>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u80fd\u529b<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u5173\u952e API<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u53d1\u5e03 \/ \u66f4\u65b0<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">notify(\u540c\u4e00 ID)<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u70b9\u51fb\u8df3\u8f6c<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">PendingIntent.getActivity<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u8fd4\u56de\u6808<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">TaskStackBuilder<\/code> + parentActivityName<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u8fdb\u5ea6<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setProgress(max, progress, indeterminate)<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u81ea\u5b9a\u4e49 UI<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">RemoteViews<\/code> + <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setContent<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\"><strong>\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1aNotificationCompat.Builder \u914d UI + PendingIntent\uff0c\u540c\u4e00 ID \u518d notify \u5373\u66f4\u65b0\uff1b\u8981\u8fd4\u56de\u6808\u7528 TaskStackBuilder\uff0c\u8981\u8fdb\u5ea6\u53cd\u590d setProgress\uff0c\u8981\u81ea\u5b9a\u4e49\u754c\u9762\u7528 RemoteViews\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>Notification \u662f\u5728 App \u5e38\u89c4 UI \u4e4b\u5916\u63d0\u793a\u4e8b\u4ef6\u7684\u4ea4\u4e92\uff1a\u7528\u6237\u53ef\u4ee5\u5728\u7528\u522b\u7684 app \u65f6\u770b\u5230\u901a\u77e5\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[65],"tags":[80],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/910"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=910"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/910\/revisions"}],"predecessor-version":[{"id":918,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/910\/revisions\/918"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=910"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}