2011-08-12 34 views
1

我永远达不到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); 
} 
} 
+0

你使用的是什么android版本?如果您使用的是3.1+,则可能需要检查以下内容:http://commonsware.com/blog/2011/07/05/boot-completed-regression.html – 2011-08-12 14:10:22

回答

2

是否包含在您的清单文件中RECEIVE_BOOT_COMPLETED许可?

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

+0

未启动。 – Nayden

+0

我看不到任何其他可能是错误的。它是不是被叫或服务的接收器?也许尝试像这样:Log.d(“BootReceiver”,“开始...”);在onReceive()中。 – Rekhyt

+0

nope,不会注销enything,不会转到Log.d(..)上的断点; – Nayden

相关问题