BroadcastReceiver的不接受BOOT

编程入门 行业动态 更新时间:2024-10-25 14:35:10
本文介绍了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

本文发布于:2023-11-27 10:31:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637707.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不接受   BroadcastReceiver   BOOT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!