简体   繁体   English

应用被杀死后,某些Android手机中的小部件无法在AppWidgetProvider中接收广播

[英]Widget in some android phone can not receive broadcast in AppWidgetProvider when app has been killed

In the commom way, we receive events invoked by widget in AppWidgetProvider which is a BroadcastReceiver.But some Android Device can't not receive broadcast in AppWidgetProvider when the app is kill. 以交流的方式,我们在AppWidgetProvider中接收由widget调用的事件,该事件是BroadcastReceiver。但是当应用被杀死时,某些Android设备无法在AppWidgetProvider中接收广播。

Any kind people can offer me some help? 有什么人可以为我提供帮助吗?

Now I know how to fix it. 现在我知道如何解决它。

In AppWidgetProvider, I use PendingIntent.getService instead of PendingIntent.getBroadcast to bind event to RemoteView. 在AppWidgetProvider中,我使用PendingIntent.getService而不是PendingIntent.getBroadcast将事件绑定到RemoteView。 And I handle the event from widget in a service. 我从服务中的小部件处理事件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android:如果应用程序进程被杀死,动态注册的广播接收器将被激活 - Android: will the dynamically registered broadcast receiver be activated if the app process has been killed 当应用程序被杀时,Android广播接收器无法正常工作 - Android Broadcast Receiver not working when the app is killed 当手机远离配对设备时,Android应用程序将收到BluetoothDevice.BOND_NONE广播 - android app will receive the BluetoothDevice.BOND_NONE broadcast when phone is away from the paired device at a distance Android广播接收器,每次应用启动时都会接收广播 - Android broadcast receiver, receive a broadcast every time when app launched Android-当应用被终止时,从下载管理器接收广播 - Android - Receiving broadcast from Download Manager when the app is killed Android - 当应用程序被杀死以回收资源时是否存在系统广播意图? - Android - Is there a system broadcast intent when an app is killed to reclaim resources? 当应用程序在 android 版本 9 中被杀死时收听呼叫广播接收器 - listen to call broadcast receiver when app gets killed in android version 9 当 React Native Android 应用程序在后台或已被杀死时,如何将其带到前台? - How to bring a React Native Android app to the foreground when it is in the background or has been killed? Android:单击窗口小部件中的按钮时,接收自定义广播 - Android : Receive custom broadcast when a button in a widget is clicked 应用程式被杀死后,片段仍然存在(Android) - Fragment is still alive after app has been killed (Android)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM