<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="kr.pe.theeye.gobackground"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<service android:name = "BootSvc"></service>
<receiver android:name=".BRcvr"
android:enabled="true"
android:exported="false"
android:label="Broadcast Receiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application>
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission> -->
</manifest>
package kr.pe.theeye.gobackground;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
public class BootSvc extends Service {
@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate(){
super.onCreate();
Log.i("0000aaa","서비스 시작은 재부팅 후에");
}
}
package kr.pe.theeye.gobackground;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class BRcvr extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED"))
{
Log.i("BOOTSVC", "인텐트 받기");
ComponentName cn = new ComponentName(context.getPackageName(),BootSvc.class.getName());
ComponentName svcName = context.startService(new Intent().setComponent(cn));
if(svcName == null)
Log.e("BOOTSVC", "에러!" + cn.toString());
}
}
}
아무것도 안뜸니다;;