BroadcastReceiver的不接受BOOT_COMPLETED [英] BroadcastReceiver not receiving BOOT_COMPLETED

查看:163
本文介绍了BroadcastReceiver的不接受BOOT_COMPLETED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我环顾四周,这里对于类似的问题,但由于某些原因,我的BroadcastReceiver永远结束了接收android.intent.action.BOOT_COMPLETED意向。

I've looked around here for similiar problems, but for some reason my BroadcastReceiver never ends up receiving the android.intent.action.BOOT_COMPLETED Intent.

下面是我的(相对)Android.Manifest文件:

Here is my (relative) Android.Manifest File:

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>    
<receiver android:name=".BootReceiver"
        android:enabled="true"
        android:exported="true"
        android:label="BootReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED"></action>

        </intent-filter>
    </receiver>

和下面是实际的接收器。

And Here is the actual Receiver.

public class BootReceiver extends BroadcastReceiver {
private static final String TAG="BootReceiver";

@Override public void onReceive(Context context,Intent intent){
    try{
        context.startService(new Intent(context,ConnectivityListener.class));
        Log.i(TAG,"Starting Service ConnectivityListener");
    }catch(Exception e){
        Log.e(TAG,e.toString());
    }
}
}

谢谢!任何帮助是极大AP preciated

Thanks! Any help is greatly appreciated

推荐答案

原来,接收器是不是在明显的标记。哎呦!感谢您的帮助家伙!有关测试这一最糟糕的是必须保持关闭,并在手机上。 :P

Turns out the receiver wasn't in the tag of the manifest. Whoops! Thanks for your help guys! The worst part about testing this is having to keep turning off and on the phone. :P

这篇关于BroadcastReceiver的不接受BOOT_COMPLETED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆