{"id":446,"date":"2014-03-22T12:53:38","date_gmt":"2014-03-22T03:53:38","guid":{"rendered":"http:\/\/www.uturtle.com\/blog\/?p=446"},"modified":"2014-03-22T12:56:51","modified_gmt":"2014-03-22T03:56:51","slug":"sdk%eb%b2%84%ec%a0%bc-8%ec%9d%b4%ec%83%81%ec%97%90%ec%84%9c-android-notification-%ea%b5%ac%ed%98%84-%eb%b0%a9%eb%b2%95","status":"publish","type":"post","link":"https:\/\/www.jinukbaek.com\/blog\/ko\/archives\/446","title":{"rendered":"SDK\ubc84\uc83c 8\uc774\uc0c1\uc5d0\uc11c Android Notification \uad6c\ud604 \ubc29\ubc95"},"content":{"rendered":"<p><strong>\u203b \uc774 \ubb38\uc11c\ub294 Notification \uc790\uccb4\uc5d0 \ub300\ud574\uc11c \uc124\uba85\ud558\uace0 \uc788\ub294 \uac83\uc774 \uc544\ub2c8\ub77c Notification\uc744 \uc54c\uace0 \uc788\ub2e4\ub294 \uac00\uc815\ud558\uc5d0\uc11c \ub9cc\ub4e4\uc5b4\uc57c \ud560 \uc571\uc774 API Level 11 \ubbf8\ub9cc\uc744 \uc9c0\uc6d0\ud574\uc57c\ud560 \u00a0\uacbd\uc6b0\ub97c \uc704\ud55c \uc124\uba85\uc774\ub2e4. Notification \uc790\uccb4\uc5d0 \ub300\ud55c \uc774\ud574\ub294 [1]\uc744 \ucc38\uc870\ud558\ub3c4\ub85d \ud55c\ub2e4.<\/strong><\/p>\n<p>\uc548\ub4dc\ub85c\uc774\ub4dc Notification\uc744 \uad6c\ud604\ud558\ub294 \ubc29\ubc95\uc740 \uc5ec\ub7ec\uac00\uc9c0\uac00 \uc788\ub294\ub370 \ud558\ub098\ub294 \uae30\ubcf8 \uc81c\uacf5\ud558\ub294 \uc591\uc2dd\uc744 \uc0ac\uc6a9\ud558\ub294 \ubc29\ubc95, \ub2e4\ub978 \ud558\ub098\ub294 Custom layout\uc744 \uc774\uc6a9\ud558\uc5ec \uad6c\ud604\ud558\ub294 \ubc29\ubc95\uc774 \uc788\ub2e4. \uc774 \uc911\uc5d0 \uae30\ubcf8 \uc81c\uacf5 \uc591\uc2dd\uc744 \uc0ac\uc6a9\ud558\ub294 \ubc29\ubc95\uc73c\ub85c \uad6c\ud604\uc744 \ud574 \ubcf4\uace0\uc790 \ud55c\ub2e4.<\/p>\n<p>\ud558\uc9c0\ub9cc \uc548\ud0c0\uae5d\uac8c\ub3c4 \ud0c0\uac9f \ud50c\ub81b\ud3fc \ubc84\uc83c\uc774 8(Android 2.2, Froyo)\uc774\uc0c1\uc73c\ub85c \ud574\uc57c \ud588\uae30 \ub54c\ubb38\uc5d0 \ubb38\uc81c\uac00 \ubc1c\uc0dd\ud588\ub2e4. \ubc14\ub85c \uae30\ubcf8 \uc81c\uacf5 \ubc29\ubc95\uc744 \uc0ac\uc6a9\ud560 \uacbd\uc6b0\uc5d0 Notification\uc758 \uc0dd\uc131\uc790\uac00 <strong>deprecated<\/strong> \ub42c\uae30 \ub54c\ubb38\uc774\ub2e4. \uc989 \uc0ac\uc6a9\ud558\uc9c0 \uc54a\ub294 \uac83\uc774 \uc88b\ub2e4\ub294 \ub73b\uc774\ub2e4. \ubc14\ub85c \uc774 \uba54\uc18c\ub4dc\uac00 \ubb38\uc81c!<\/p>\n<p><figure id=\"attachment_447\" aria-describedby=\"caption-attachment-447\" style=\"width: 813px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/www.jinukbaek.com\/blog\/wp-content\/uploads\/2014\/03\/notification_deprecated.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"447\" data-permalink=\"https:\/\/www.jinukbaek.com\/blog\/ko\/archives\/446\/notification_deprecated\" data-orig-file=\"https:\/\/i0.wp.com\/www.jinukbaek.com\/blog\/wp-content\/uploads\/2014\/03\/notification_deprecated.png?fit=813%2C225&amp;ssl=1\" data-orig-size=\"813,225\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"The notification constructor is deprecated\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.jinukbaek.com\/blog\/wp-content\/uploads\/2014\/03\/notification_deprecated.png?fit=640%2C177&amp;ssl=1\" class=\"size-full wp-image-447\" alt=\"The notification constructor is deprecated\" src=\"https:\/\/i0.wp.com\/www.jinukbaek.com\/blog\/wp-content\/uploads\/2014\/03\/notification_deprecated.png?resize=640%2C177&#038;ssl=1\" width=\"640\" height=\"177\" srcset=\"https:\/\/i0.wp.com\/www.jinukbaek.com\/blog\/wp-content\/uploads\/2014\/03\/notification_deprecated.png?w=813&amp;ssl=1 813w, https:\/\/i0.wp.com\/www.jinukbaek.com\/blog\/wp-content\/uploads\/2014\/03\/notification_deprecated.png?resize=300%2C83&amp;ssl=1 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><figcaption id=\"caption-attachment-447\" class=\"wp-caption-text\">Notification\uc758 \uc0dd\uc131\uc790 Reference[2]<\/figcaption><\/figure>\u00a0 \u00a0\ube68\uac04 \ub124\ubaa8\ubc15\uc2a4\uc758 \ub0b4\uc6a9\uacfc \uac19\uc774 SDK 11\ubc84\uc83c\ubd80\ud130\ub294 <strong>Notification.Builder<\/strong>\ub97c \ub300\uc2e0 \uc0ac\uc6a9\ud558\ub77c\ub294 \uac83\uc744 \uc54c \uc218 \uc788\ub2e4. \u00a0\uadf8\ub7ec\uba74 \uc5b4\ub5bb\uac8c \ud574\uc57c\ud560\uae4c? \uc5ec\ub7ec \uc778\ud130\ub137 \uc0ac\uc774\ud2b8\ub97c \ucc3e\uc544\ubcf4\ub358 \ub3c4\uc911 \ud55c \uc0ac\uc774\ud2b8[3]\ub97c \ubc1c\uacac\ud588\uace0, \uadf8\uacf3\uc5d0 \ub530\ub974\uba74 \ube4c\ub4dc \ud658\uacbd\uc5d0 \ub530\ub77c\uc11c \ub2e4\ub978 \uba54\uc18c\ub4dc\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\uac8c \ud574\uc900\ub2e4\ub294 \uac83\uc774\uc600\ub2e4. \uc544\ub798\uc640 \uac19\uc740 \ubc29\ubc95\uc73c\ub85c \uac00\ub2a5\ud558\ub2e4.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"lang:java decode:true\">if(Build.VERSION.SDK_INT &gt;= 11) {\r\n   \/\/ \uc548\ub4dc\ub85c\uc774\ub4dc \ud50c\ub81b\ud3fc \ubc84\uc83c(API Level)\uc774 11 \uc774\uc0c1\uc77c \uacbd\uc6b0 \uc2e4\ud589\r\n} else {\r\n   \/\/ \uc548\ub4dc\ub85c\uc774\ub4dc \ud50c\ub81b\ud3fc \ubc84\uc83c\uc774 11 \ubbf8\ub9cc\uc77c \uacbd\uc6b0 \uc2e4\ud589\r\n}<\/pre>\n<p>\uc989 \u00a0Notification\uc744 11\ubbf8\ub9cc\uc77c \ub54c\uc640 11 \uc774\uc0c1\uc77c \uacbd\uc6b0\ub97c \ub2e4\ub974\uac8c \ud558\uc5ec \uad6c\ud604\ud558\uba74 \ub41c\ub2e4\ub294 \uac83! \uc544\ub798 \ucf54\ub4dc\ub97c \ubcf4\uc790<\/p>\n<pre class=\"lang:java decode:true\">int icon = context.getApplicationInfo().icon \/\/ Notification \ubc1c\uc0dd\uc2dc \ucd9c\ub825\ud560 \uc544\uc774\ucf58\r\nString title = \"\"; \/\/ Notification \ubc1c\uc0dd\uc2dc \uc544\ub798\ub85c \ub0b4\ub838\uc744 \ub54c \uccab\ubc88\uc9f8 \uc904\r\nString subtitle = \"\"; \/\/ Notification \ubc1c\uc0dd\uc2dc \uc544\ub798\ub85c \ub0b4\ub838\uc744 \ub54c \ub450\ubc88\uc9f8 \uc904\r\nString ticker = \"\"; \/\/ \uc774\ubca4\ud2b8 \ubc1c\uc0dd\uc2dc \uc704\uc5d0 \ucd9c\ub825\ub420 \ub0b4\uc6a9 \r\nNotification noti;\r\n\r\nif(Build.VERSION.SDK_INT &gt;= 11) {\r\n    noti = new Notification.Builder(context)\r\n      .setContentTitle(title)\r\n      .setContentText(subtitle)\r\n      .setTicker(ticker)\r\n      .setSmallIcon(icon)\r\n      .setContentIntent(pIntent)\r\n      .build();\r\n} else {\r\n    noti = new Notification(icon, ticker, System.currentTimeMillis());\r\n    noti.setLatestEventInfo(context, title, subtitle, pIntent);\r\n}<\/pre>\n<p>\uc704\uc640 \uac19\uc774 \uad6c\ud604\ud558\uba74 \ucd5c\uc18c SDK \ubc84\uc83c\uc5d0 \uad00\uacc4 \uc5c6\uc774 \uad6c\ud604\uac00\ub2a5\ud558\ub2e4. \uc2e4\uc81c\ub85c\ub294 \uc704\uc640 \uac19\uc774 \uad6c\ud604\ud558\uba74 \ucd5c\uc18c API Level\uc774 8\uc774\uae30 \ub54c\ubb38\uc5d0 11\uc5d0\uc11c \ucd94\uac00\ub41c Notification.Builder\ub294 \uc774\uc6a9\ud560 \uc218 \uc5c6\uc9c0\ub9cc \uc704\uc640 \uac19\uc774 \ud558\uba74 \ubb38\uc81c\uc5c6\uc774 \ube4c\ub4dc \uac00\ub2a5\ud558\ub2e4. \ub9cc\uc57d \uc5d0\ub7ec\uac00 \ub09c\ub2e4\uba74 \ud504\ub85c\uc81d\ud2b8\ub97c clean\ud558\uc5ec \ub2e4\uc2dc \ube4c\ub4dc\ud558\ub3c4\ub85d \u00a0\ud558\uc790.<\/p>\n<p>API \ub808\ubca8\uc5d0 \ub300\ud574\uc11c\ub294 [3][4]\uc744 \ucc38\uc870\ud558\ub3c4\ub85d \ud55c\ub2e4.<\/p>\n<p>&nbsp;<\/p>\n<h3>\u00a0\ucc38\uace0\uc790\ub8cc<\/h3>\n<hr \/>\n<p>[1] Android Developer &#8211; Notifications, \u00a0https:\/\/developer.android.com\/guide\/topics\/ui\/notifiers\/notifications.html<br \/>\n[2] Android Developer &#8211; References,\u00a0https:\/\/developer.android.com\/reference\/android\/app\/Notification.html#Notification(int, java.lang.CharSequence, long)<br \/>\n[3] \u3010android\u3011OS\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\uff08API\u30ec\u30d9\u30eb\uff09\u306b\u3088\u3063\u3066\u51e6\u7406\u3092\u5909\u3048\u308b\u65b9\u6cd5,\u00a0http:\/\/nobuo-create.net\/api\/<br \/>\n[4] Android Developer &#8211; API Level,\u00a0http:\/\/developer.android.com\/guide\/topics\/manifest\/uses-sdk-element.html#ApiLevels<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u203b \uc774 \ubb38\uc11c\ub294 Notification \uc790\uccb4\uc5d0 \ub300\ud574\uc11c \uc124\uba85\ud558\uace0 \uc788\ub294 \uac83\uc774 \uc544\ub2c8\ub77c Notification\uc744 \uc54c\uace0 \uc788\ub2e4\ub294 \uac00\uc815\ud558\uc5d0\uc11c \ub9cc\ub4e4\uc5b4\uc57c \ud560 \uc571\uc774 API<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[59],"tags":[188,187,189],"class_list":["post-446","post","type-post","status-publish","format-standard","hentry","category-computer-scienceandroid","tag-android-notifications","tag-187","tag-189"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8gT1J-7c","_links":{"self":[{"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/posts\/446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/comments?post=446"}],"version-history":[{"count":7,"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/posts\/446\/revisions"}],"predecessor-version":[{"id":454,"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/posts\/446\/revisions\/454"}],"wp:attachment":[{"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/media?parent=446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/categories?post=446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jinukbaek.com\/blog\/wp-json\/wp\/v2\/tags?post=446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}