安卓:为什么我没有收到BOOT

编程入门 行业动态 更新时间:2024-10-25 16:20:33
本文介绍了安卓:为什么我没有收到BOOT_COMPLETED意图是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我测试的物理设备上(SAMSUNG ACE GT S5830i)

I am testing on an physical device (SAMSUNG ACE GT S5830i)

但我没有收到BOOT_COMPLETED意图,因此该服务未接收器没有启动

But I am not receiving the BOOT_COMPLETED intent therefore the service is not Receiver is not starting

这是code我使用。

This is the code I am using.

public class BootCompleteReceiver extends BroadcastReceiver { static final String TAG = "InfoService.BroadcastReceiver"; @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { Log.e(TAG, "System boot notification received."); Intent service = new Intent(context, InfoService.class); context.startService(service); } else { Log.e(TAG, "Intent received: " + intent); } } }

这是清单

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="schemas.android/apk/res/android" package="com.appengine.paranoid_android.lost" android:versionCode="2" android:versionName="1.1"> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name"> <activity android:name=".InfoSetup" android:label="@string/activity_name" android:launchMode="singleTask" android:clearTaskOnLaunch="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".LockScreen" android:label="@string/activity_name" android:launchMode="singleInstance" android:clearTaskOnLaunch="true" android:theme="@android:style/Theme.NoTitleBar"> </activity> <service android:name=".InfoService" android:label="@string/service_name"/> <receiver android:name=".BootCompleteReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.PACKAGE_ADDED"/> <action android:name="android.intent.action.PACKAGE_CHANGED"/> <action android:name="android.intent.action.PACKAGE_REMOVED"/> <data android:scheme="package"/> </intent-filter> </receiver> </application> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.WRITE_SETTINGS"/> <uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> <!-- <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> -->

推荐答案

尝试与包添加的完整路径,&lt;接收机器人:名字=。BootCompleteReceiver&GT;

Try to add the full path with the package for <receiver android:name=".BootCompleteReceiver">

<receiver android:name="com.appengine.paranoid_android.lost.BootCompleteReceiver">

更多推荐

安卓:为什么我没有收到BOOT

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

发布评论

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

>www.elefans.com

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