어플을 기기가 부팅시 자동실행되게 수정하고 싶어 receiver.java파일만들어서


public class BootReceiver extends BroadcastReceiver{

@Override

public void onReceive(Context context, Intent intent) {

String action = intent.getAction();

if(action.equals("android.intent.action.BOOT_COMPLETED")){

ComponentName comp = new ComponentName(context.getPackageName(), 어플메인activity.class.getName());

ComponentName service = context.startService(new Intent().setComponent(comp));

}

}

}


이렇게 작성했구요 메니페스트에도 구글링으로 찾은대로 코딩했는데 리붓을 해도 어플이 실행이 안되네요? 뭐가 문제일까요

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission> 

<receiver 

   android:enabled="true"

   android:exported="false" 

   android:name=".BootReceiver" 

   android:label="@string/app_name"> 

    <intent-filter> 

    <action android:name="android.intent.action.BOOT_COMPLETED" /> 

    <category android:name="android.intent.category.LAUNCHER" /> 

    </intent-filter> 

</receiver>