【发布时间】:2017-06-23 14:48:07
【问题描述】:
当我使用模拟器时,警报工作正常。但是当我在实际设备上尝试时不起作用。
应用打开时的输出。
RTC #8: Alarm{2c1fc9e type 1 when 1486492260454 user.com.hlthee}
tag=*alarm*:user.com.hlthee/.UpdateTables
type=1 whenElapsed=+22h43m2s644ms when=2017-02-08 00:01:00
window=-1 repeatInterval=86400000 count=0
operation=PendingIntent{7c4e37f: PendingIntentRecord{3f5fbf4c user.com.hlthee broadcastIntent}}
但是当我关闭应用程序时,此条目被删除。为什么?这就是闹钟不响的原因。
警报接收器广播器清单文件。
<receiver android:name=".UpdateTables"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
请不要说使用服务并在那里注册接收器。我想我正在清单中注册接收器,它会起作用。并且还在模拟器中正常工作时发出警报。从过去 3 天开始无法解决此问题。任何帮助都会有所帮助。
我也试过这些方法:
- 使用 wakefullBroadcastReceiver 代替 BroadcastReceiver
- 使用 setAlarmclock 代替 setExact。
任何人也面临同样的问题。
【问题讨论】:
-
你在使用小米设备吗?
-
你在什么手机上测试它?某些品牌,例如华为,要求用户将应用添加到信任列表中
-
是的,我正在使用 Mi @Saveen
-
我在moto G 1(XT1033)上测试过
-
@matip 我正在使用 mi 和 moto 手机进行测试,
标签: android alarmmanager alarm android-alarms repeatingalarm