【发布时间】:2013-12-14 21:46:05
【问题描述】:
我有一个 android 应用程序,我在其中安排一个事件(位置更新),以便在将来使用警报管理器执行。只要应用程序在前台或后台运行,计划的事件就会按预期执行。但是一旦我在任务管理器下强制关闭应用程序,或者当应用程序在后台时由于内存问题而导致android系统终止应用程序时,我将不再能够接收来自警报管理器的广播。
正如我尝试使用的各种帖子和博客所建议的那样 1) Intent.Flag_Include_Stopped_Packages 2) 清单中的接收者 android:process=":remote" 3) 清单中的接收器 android:exported="true"
服务中:
Intent locationIntent = new Intent("com.dummy.intent");
locationIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
locationIntent.putExtra(LocationLibraryConstants.LOCATION_BROADCAST_EXTRA_LOCATIONINFO, locationInfo);
context.sendBroadcast(locationIntent, "android.permission.ACCESS_FINE_LOCATION");
在清单中:
<receiver android:name=".NearestStationBroadcastReceiver" android:enabled="true"
android:exported="true"
android:process=":remote">
<intent-filter>
<action android:name="com.dummy.intent" />
</intent-filter>
</receiver>
有人可以帮帮我吗?
【问题讨论】:
标签: android broadcastreceiver intentfilter