开发者

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 onRe开发者_C百科ceive(Context context, Intent intent) {
    Intent serviceIntent = new Intent();

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

    context.startService(serviceIntent);
}
}


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜