我无法启动我的接收器

时间:2011-08-12 13:35:43

标签: android broadcastreceiver

我从未到过BootReceiver? 在我的清单中我有:

 <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>

在我的BootReceiver上我有:

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);
}
}

1 个答案:

答案 0 :(得分:2)

您是否在清单文件中包含RECEIVE_BOOT_COMPLETED权限?

<强>更新 找到了What does it mean "No Launcher activity found!"中的内容。您应该能够将服务定义为MAIN和LAUNCHER,两者似乎都是强制性的。也不知道。