ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î

[°³¹ß Tip] ºÎÆýà ¼­ºñ½º ½ÇÇàÇϱâ
7³â Àü
// BootDemoReceiver.java
package com.enea.training.bootdemo;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
* Simple receiver that will handle the boot completed intent and send the intent to
* launch the BootDemoService.
* @author BMB
*
*/
public class BootDemoReceiver extends BroadcastReceiver {
@Override
public void onReceive(final Context context, final Intent bootintent) {
  Intent mServiceIntent = new Intent();
mServiceIntent.setAction("com.enea.training.bootdemo.BootDemoService");
  context.startService(mServiceIntent);
}
}

// BootDemoService.java
package com.enea.training.bootdemo;

import java.util.Timer;
import java.util.TimerTask;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

/**
* Simple demo service that schedules a timer task to write something to
* the log at regular intervals.
* @author BMB
*
*/
public class BootDemoService extends Service {
/**
  * Delay until first exeution of the Log task.
  */
private final long mDelay = 0;
/**
  * Period of the Log task.
  */
private final long mPeriod = 500;
/**
  * Log tag for this service.
  */
private final String LOGTAG = "BootDemoService";
/**
  * Timer to schedule the service.
  */
private Timer mTimer;

/**
  * Implementation of the timer task.
  */
private class LogTask extends TimerTask {
  public void run() {
   Log.i(LOGTAG, "scheduled");
  }
}
private LogTask mLogTask;

@Override
public IBinder onBind(final Intent intent) {
  return null;
}

@Override
public void onCreate() {
  super.onCreate();
  Log.i(LOGTAG, "created");
  mTimer = new Timer();
  mLogTask = new LogTask();
}

@Override
public void onStart(final Intent intent, final int startId) {
  super.onStart(intent, startId);
  Log.i(LOGTAG, "started");
  mTimer.schedule(mLogTask, mDelay, mPeriod);
}
}
// AndroidManifest.xml
< ?xml version="1.0" encoding="utf-8"?>
< manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.enea.oresund.training.bootdemo"
      android:versionCode="1"
      android:versionName="1.0">
      < uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    < application android:icon="@drawable/icon" android:label="@string/app_name">
       < service android:name=".BootDemoService">
       < intent-filter>
       < action
       android:name = "com.enea.training.bootdemo.BootDemoService">
       < /action>
       < /intent-filter>
       < /service>
       < receiver android:name=".BootDemoReceiver">
       < intent-filter>
       < action
       android:name ="android.intent.action.BOOT_COMPLETED">
       < /action>
       < /intent-filter>
       < /receiver>
    < /application>
    < uses-sdk android:minSdkVersion="3" />
< /manifest>

http://androidenea.blogspot.com/2009/09/starting-android-service-after-boot.html
ÃßõÃßõ : 239 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
1,196
Service & Notification(¾Ë¸²¹Ù¶ç¿ì±â) ÀÌ¿ëÇϱâ
1,195
È­¸é ȸÀü(rotation) ó¸®
1,194
[Android] Àüüȭ¸é, title bar ¾ø¾Ö±â, status bar ¾ø¾Ö±â
1,193
ANDROID(¾Èµå·ÎÀ̵å) ¾Û °³¹ß ±âÃÊ] MEDIAPLAYER À½¾Ç Àç»ýÇϱâ
1,192
[Android]MediaPlayer¿¡¼­ »ç¿îµå¸¦ Àç»ýÇÏ´Â µÎ °¡Áö °æ·Î
1,191
¾Èµå·ÎÀ̵å Intent »ç¿ë¹ý
1,190
¾Èµå·ÎÀ̵å È­¸é Á¤¸®
1,189
ffmpeg ¿ÀÇ ¼Ò½º on ¾Èµå·ÎÀ̵å
1,188
WebView¿¡¼­ <a> ű×ÀÇ "_blank" target ó¸®Çϱâ.
1,187
Ư¼ö¹®ÀÚ, Ư¼ö¹®ÀÚÇ¥, Ư¼ö¹®ÀÚ ÇÏÆ®, ¿¹»Û Ư¼ö¹®ÀÚ
1,186
MediaPlayer 5¹ø¸¸ ¹Ýº¹Àç»ý
1,185
ÆÄÀÏ À§Ä¡¿¡ µû¸¥ ¹Ìµð¾î Àç»ý »ùÇÃÄÚµå
1,184
MJPEG on Android anyone?
1,183
Android °³¹ß
1,182
¾Èµå·ÎÀ̵å : ¾×ƼºñƼ ¶óÀÌÇÁ »çÀÌŬ (Activity Life Cycle)
1,181
¾Èµå·ÎÀ̵å ÇÁ·Î±×·¥ ÄÚµå·Î À¥ ºê¶ó¿ìÀú ½ÇÇàÇϱ⠿¹Á¦ (ÀÎÅÙÆ® »ç¿ë)
1,180
Áøµ¿ È¿°ú [Android]
1,179
Á¾·á ´ÙÀ̾ó·Î±× [Android]
1,178
´Ù¸¥¾Û È£Ãâ [Android]
1,177
TabActivity back key Event [Android]
1,176
³×Æ®¿öÅ© »óÅ [Android]
1,175
¾Èµå·ÎÀ̵忡¼­ À¥¼­¹ö¿¡ post·Î ±Û¾²±â [Android]
1,174
Webview ¼Ò½º [Android]
1,173
Coach mark View [Android]
1,172
¸ÖƼ ÇØ»óµµ [Android]
1,171
Webview source [Android]
1,170
°øÀ¯ Intent [Android]
1,169
intent uri ¸ðÀ½ [Android]
1,168
http post [Android]
1,167
http ¿äû [Android]
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.