{"id":495,"date":"2013-05-20T13:33:37","date_gmt":"2013-05-20T13:33:37","guid":{"rendered":"http:\/\/nangchang.nes.or.kr\/?p=495"},"modified":"2013-05-20T13:33:37","modified_gmt":"2013-05-20T13:33:37","slug":"%ec%95%88%eb%93%9c%eb%a1%9c%ec%9d%b4%eb%93%9c%ec%95%b1%ec%9d%b4-%ed%95%ad%ec%83%81-%ec%8b%9c%ec%9e%91%eb%90%98%eb%8f%84%eb%a1%9d-%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/nangchang.nes.or.kr\/?p=495","title":{"rendered":"\uc548\ub4dc\ub85c\uc774\ub4dc\uc571\uc774 \ud56d\uc0c1 \uc2dc\uc791\ub418\ub3c4\ub85d \ud558\uae30"},"content":{"rendered":"<p>\uadfc 1\ub144 \uc804\uc5d0 \uc548\ub4dc\ub85c\uc774\ub4dc\uc571\uc774 \ud56d\uc0c1 \uc2e4\ud589\ub418\uc5b4 \uc788\ub3c4\ub85d \ud558\uae30 \uc704\ud574\uc11c \uc37c\ub358 \ubc29\ubc95.<br \/>(\uadf8 \ub54c \ub2f9\uc2dc \uc790\ub3d9 \uc5c5\ub370\uc774\ud2b8 \uae30\ub2a5\uc73c\ub85c \uc5c5\ub370\uc774\ud2b8 \ud6c4 \ub2e4\uc2dc \uc2e4\ud589\ud558\ub294 \uac83\ub3c4 \uc774 \ubc29\ubc95\uc73c\ub85c \ud574\uacb0\ud588\uc74c)<\/p>\n<p>\uc6b0\uc120 Activity \uc758 \uc778\uc2a4\ud134\uc2a4\uac00 1\uac1c\ub9cc \uc874\uc7ac\ud558\ub3c4\ub85d \ud574\uc57c \ud558\ubbc0\ub85c \uba54\uc778 activity\uc758<br \/>lanuchMode\ub97c singleTask\ub85c \uc124\uc815\ud574 \uc900\ub2e4.<\/p>\n<blockquote>\n<div>&lt;activity<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:name=&#8221;.SampleActivity&#8221;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:label=&#8221;@string\/app_name&#8221; android:theme=&#8221;@android:style\/Theme.NoTitleBar.Fullscreen&#8221;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <strong>android:launchMode=&#8221;singleTask&#8221;<\/strong>&gt;<\/div>\n<\/blockquote>\n<p>\uadf8\ub9ac\uace0, Service \ub97c \ud558\ub098 \ucd94\uac00\ud558\uace0, Service\uc5d0\uc11c Alarm \uc73c\ub85c &nbsp;\uba54\uc778 Activity\uc5d0 \uc8fc\uae30\uc801\uc73c\ub85c Intent\ub97c \ub0a0\ub9ac\ub3c4\ub85d \ud55c\ub2e4.<\/p>\n<blockquote>\n<div>public class SampleService extends Service<br \/>{<br \/>&nbsp; &nbsp; private static final int ALARM_INTERVAL = 30000;<br \/>&nbsp; &nbsp; private boolean bRunning = false;<\/p>\n<p>&#8230;<\/p>\n<p>&nbsp; &nbsp; public int onStartCommand(Intent intent, int flags, int startId) {<br \/>&nbsp; &nbsp; &nbsp; &nbsp; if (!bRunning) {<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bRunning = true; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final Intent alarmIntent = new Intent(this, SampleActivity.class);<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final PendingIntent pender = PendingIntent.getActivity(this, 0, alarmIntent, 0);<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long triggerTime = SystemClock.elapsedRealtime() + 1000*30;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final AlarmManager alarm = (AlarmManager) this<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .getSystemService(Context.ALARM_SERVICE);<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alarm.setRepeating(AlarmManager.ELAPSED_REALTIME, triggerTime,<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ALARM_INTERVAL, pender);<br \/>&nbsp; &nbsp; &nbsp; &nbsp; } else {<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Log.e(&#8220;hadpan&#8221;, &#8220;sample service thread is already running&#8221;);<br \/>&nbsp; &nbsp; &nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; return START_STICKY;<br \/>&nbsp; &nbsp; }<\/p>\n<p>&#8230;<\/p>\n<p>}<\/div>\n<\/blockquote>\n<p>\ud574\ub2f9 Activity\uac00 singleTask \ub85c \uc124\uc815\ub418\uc5c8\uae30 \ub54c\ubb38\uc5d0 Activity\uac00 \uc874\uc7ac \ud55c\ub2e4\uba74, \ud654\uba74\uc774 \ud65c\uc131\ud654 \ub418\uace0,<br \/>\uc544\uc9c1 \ub9cc\ub4e4\uc5b4\uc9c0\uae30 \uc804\uc774\ub77c\uba74 \uc0c8\ub85c \uc571\uc744 \uc2e4\ud589\ud558\uac8c \ub41c\ub2e4.<\/p>\n<p>alarm \uc8fc\uae30\ub294 \ud544\uc694\uc5d0 \ub530\ub77c \uc801\ub2f9\ud788 \uc870\uc808\ud558\uba74 \ub418\ub294\ub370.. \uc0ac\uc2e4 \uc774\ub7f0 alram\uc744 \uc4f0\ub294\uac70 \uc790\uccb4\uac00 \ubcc4\ub85c \uad8c\uc7a5\ud558\ub294 \ubc29\ubc95\uc740 \uc544\ub2c8\ub2e4.<br \/>\ub2f9\uc2dc, \ub9cc\ub4e4\ub358 \uc571 \uc790\uccb4\uac00 \ub2e8\ub9d0\uae30\ub97c \uc804\uc6a9 \ub2e8\ub9d0\uae30 \ucc98\ub7fc.. \uadf8\ub7ec\ub2c8\uae4c \ub2e8\ub9d0\uae30\uc5d0\uc11c \ud574\ub2f9 \uc571\ub9cc \ub3d9\uc791\ud558\uba74 \ub418\ub294 \ud615\ud0dc\uc5ec\uc11c..<br \/>(\uc77c\uc885\uc758 \ud0a4\uc624\uc2a4\ud06c \ud615\ud0dc)<\/p>\n<p>\uc774 \ubc29\ubc95\uc744 \uc0ac\uc6a9\ud588\uc9c0\ub9cc \uadf8\ub2e4\uc9c0 \uc88b\uc740 \ubc29\ubc95\uc774\ub77c\uace0\ub294 \uc0dd\uac01\ub418\uc9c0 \uc54a\uc74c&#8230;=_=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uadfc 1\ub144 \uc804\uc5d0 \uc548\ub4dc\ub85c\uc774\ub4dc\uc571\uc774 \ud56d\uc0c1 \uc2e4\ud589\ub418\uc5b4 \uc788\ub3c4\ub85d \ud558\uae30 \uc704\ud574\uc11c \uc37c\ub358 \ubc29\ubc95.(\uadf8 \ub54c \ub2f9\uc2dc \uc790\ub3d9 \uc5c5\ub370\uc774\ud2b8 \uae30\ub2a5\uc73c\ub85c \uc5c5\ub370\uc774\ud2b8 \ud6c4 \ub2e4\uc2dc \uc2e4\ud589\ud558\ub294 \uac83\ub3c4 \uc774 \ubc29\ubc95\uc73c\ub85c \ud574\uacb0\ud588\uc74c) \uc6b0\uc120 Activity \uc758 \uc778\uc2a4\ud134\uc2a4\uac00 1\uac1c\ub9cc \uc874\uc7ac\ud558\ub3c4\ub85d \ud574\uc57c \ud558\ubbc0\ub85c \uba54\uc778 activity\uc758lanuchMode\ub97c singleTask\ub85c \uc124\uc815\ud574 \uc900\ub2e4. &lt;activity&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:name=&#8221;.SampleActivity&#8221;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:label=&#8221;@string\/app_name&#8221; android:theme=&#8221;@android:style\/Theme.NoTitleBar.Fullscreen&#8221;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[15],"class_list":["post-495","post","type-post","status-publish","format-standard","hentry","category-pogramming","tag-android"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/posts\/495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=495"}],"version-history":[{"count":0,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/posts\/495\/revisions"}],"wp:attachment":[{"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}