意图BOOT

编程入门 行业动态 更新时间:2024-10-25 12:29:15
本文介绍了意图BOOT_COMPLETED在华为设备上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在我的Android应用中收听APN更改.

I want to listen to APN Changes in my Android App.

因此,我在android.intent.action.BOOT_COMPLETED上启动了服务. 该服务将启动一个ContentObserver,以监听对 content://telephony/carriers/preferapn.

Therefore I start a Service on android.intent.action.BOOT_COMPLETED. This Service starts a ContentObserver which listens to changes to content://telephony/carriers/preferapn.

我在几种不同的设备上测试了此设置(例如,装有Android 5.0的LG Spirit,具有6.0的三星A3,具有7.0的Emulator Nexus5和具有7.0的Huawei P9 Lite)

I tested this setup on a few different devices (e.g. LG Spirit with Android 5.0, Samsung A3 with 6.0, Emulator Nexus5 with 7.0 and Huawei P9 Lite with 7.0)

我的服务的华为电话onCreate上没有呼叫.

On the Huawei phone onCreate of my Service is not called.

我将android.intent.action.ANY_DATA_STATE与在清单中注册的BroadcastReceiver结合使用的其他方法在这部手机上也无法使用.

My other approach with android.intent.action.ANY_DATA_STATE in combination with a BroadcastReceiver which is registerd in the Manifest doesn't work either on this phone.

我的清单的相关部分

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> ... <receiver android:name=".ConnectivityChangeReceiver"> <intent-filter> <action android:name="android.intent.action.ANY_DATA_STATE" /> </intent-filter> </receiver> <receiver android:name=".APNChangedServiceStarter" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" /> <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/> </intent-filter> </receiver> <service android:name=".APNChangedService"></service>

推荐答案

华为手机具有内置的启动管理器,可能是尚未启用该应用程序.

Huawei Phones have a built-in startup manager, it could be that the app is not yet enabled.

转到设置">全部",然后选择启动管理器". 该程序用于管理Android手机上的启动应用程序. 在华为手机启动后,允许或禁止应用程序自动运行.

Go to Settings > All, and choose Startup manager. This program is used to manage startup apps on Android phone. Allow or disallow app to run automatically after the Huawei phone starts up.

更多推荐

意图BOOT

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

发布评论

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

>www.elefans.com

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