Nayden
Nayden

Reputation: 33

I can not start my receiver

I never reach BootReceiver?? In my manifest i have:

 <receiver android:name=".app.service.receiver.BootReceiver" android:enabled="true">            
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <category android:name="android.intent.category.HOME" />
        </intent-filter>
    </receiver>
    <service android:name=".app.service.Process">
        <intent-filter>
            <action android:name=".app.service.Process" />
        </intent-filter>
    </service>

at my BootReceiver I have:

package cc.com.app.service.receiver;

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

public class BootReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    Intent serviceIntent = new Intent();

    serviceIntent.setAction("cc.com.service.Process");

    context.startService(serviceIntent);
}
}

Upvotes: 1

Views: 281

Answers (1)

Rekhyt
Rekhyt

Reputation: 76

Did you include the RECEIVE_BOOT_COMPLETED permission in your manifest file?

Update: Found something in What does it mean "No Launcher activity found!". You should be able to define the service as MAIN and LAUNCHER, both seem to be mandatory. Didn't know that either.

Upvotes: 2

Related Questions