主要的想法是有簡單的應用程序來開啟/關閉“請勿打擾”模式。我需要從屏幕小部件訪問能夠輕鬆地為重要的商務會議安靜模式迷你應用程序。對於第一次使用,你必須設置權限切換“請勿打擾”模式,應用程序將打開設置屏幕為您服務。只要設置應用程序的權限,然後單擊回來。從這一刻起,應用程序將被允許切換靜音/正常模式。
在Android的6.0(就像我的三星S7),應用程序的權限路徑是在以下位置:
設置 - >鎖定屏幕和安全 - >其他安全設置 - >請勿打擾許可
並且可以自定義免打擾方式將如何表現 - 就像沒有任何異常(因為它是用於報警)。只要打開以下路徑和設置上的設置:
設置 - >請勿打擾 - >允許例外
Last updated on 2022年06月05日
- upgraded from API23 to API28
- using FILTER_PRIORITY instead of FILTER_ALARMS
- toggling DND will not interfere with filter priority settings
Newer android versions had strange behavior like Huawei P20 pro (reset "Allow interruptions" when opening DND settings) or Nexus emulator (DND grayed out). App should leave settings intact and user can change priority settings when DND mode is turned on. Hope this release will resolve problems and toggling DND will work as it was initially intended.
