锁屏状态下闹钟响起时按下电源键不走stopIntent

Q4: When an alarm is dismissed (either by swiping or pressing the power button), can an app detect this action and execute code in response? What about force closed apps?

When an alarm is dismissed, the stopIntent set in the AlarmConfiguration is called. Any code in the perform method of this AppIntent would execute. 我看到这样的描述,但是测试发现锁屏状态下闹钟响起时按下电源键不走AlarmConfiguration的stopIntent。设计确实是这样吗?

Answered by Neil-James in 866748022

已验证,stopIntent的perform()方法会走,可能是因为我方法中的操作太多,导致不运行perform()方法。

Accepted Answer

已验证,stopIntent的perform()方法会走,可能是因为我方法中的操作太多,导致不运行perform()方法。

锁屏状态下闹钟响起时按下电源键不走stopIntent
 
 
Q