闹钟由闹钟管理器设置,在应用关闭后被清除。

huangapple 未分类评论45阅读模式
英文:

Alarm set by alarm manager is cleaned after app is closed

问题

我已经在论坛中漫游了几天,但我找到的都是相同的重复回复,根本不起作用。
我正在尝试设置在特定时间(例如晚上8点)发送通知的闹钟。然而,只要我强行关闭应用程序,闹钟也会被清除。如果应用程序在前台运行或最小化时,它可以正常工作。
许多人在许多其他问题中提出了这个问题,并收到了相同的回答,但都不起作用。我将其中一些列举如下:

  1. 使用服务(粘性或其他类型)
  2. 对意图使用FLAG_INCLUDE_STOPPED_PACKAGES标志
  3. 在onDestroy或onTaskRemoved中再次启动服务
    还有一些其他回复,但似乎没有一个起作用。
    您是否了解任何在特定时间设置一些闹钟以发送通知的最佳实践?
    似乎在一些受限制的设备(如MIUI)中会出现此问题。
    提前感谢您的回复。
英文:

I have been roaming in forums for days and all I found was same repeated responses which don't work at all.
I am trying to set an alarm for a certain time (e.g. 8PM) to send a notification. However, as soon as I force close the app the alarm is also cleared. It works fine if app is running in the foreground or minimized.
Peopled asked this in many other questions and received same questions that none of them work. I brought some of them in the following:

  1. use service(sticky or other types)
  2. use flag FLAG_INCLUDE_STOPPED_PACKAGES for the intent
  3. start service again in onDestroy or onTaskRemoved
    some other responses none of which seems to work.
    Do you know any best practice to set some alarms to send a notification at a certain time?
    it seems like this problems happens in some devices with restrictions like MIUIs.
    Thanks in advance for your responses.

huangapple
  • 本文由 发表于 2020年7月26日 17:45:10
  • 转载请务必保留本文链接:https://java.coder-hub.com/63098509.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定