I’d like to display to the user their remaining time but can’t seem to find where to pull this information from.
While there is not a way to do this directly using a DeviceActivityCenter
or any of the DeviceActivityEvent
APIs, you can create a DeviceActivityReport
and configure its filter so that your app's DeviceActivityReportExtension
gets usage data for the tokens in your DeviceActivityEvent
. Your extension can then subtract the totalActivityDuration
from the event's threshold in seconds to get the remaining amount of time.