Update: I've updated the question, check the bottom of this post for the details I've found so far and the last problems standing in my way
My work schedule is provided to me as an online iCal file, which I have imported into Google Calendar. This way all events are visible in my Google Calendar. I'm attempting to set up my phone to switch into do-not-disturb mode when I'm at work. This is a feature that has been added in Android 6.0.
Android 6 added a neat feature to switch to Do not Disturb mode during calendar events. I managed to get this working using my default Google calendar. However, the imported events from the external iCal URL don't seem to get picked up: only events I manually add to Google Calendar turn my phone into do-not-disturb.
Time-based rules work perfectly so the feature itself is not broken.
My current settings are as follows:
Rule name: work
During events for: firstname.lastname@example.org
(into which I've imported the iCal URL)
Where reply is: Yes, Maybe or Not replied
Do not disturb: Total silence
What I've tried:
- Add the iCal URL to a different Google account
- Add the iCal URL to the Outlook app and select that account in the automatic DND settings
- Modify the iCal (using a PHP script) to add the RSVP status to every event (every event now says it has been accepted)
My phone details
Device: Oneplus One
Software: CyanogenMod 13 (the latest nightly)
Root: available if necessary
I know my way around ADB and the Linux shell if I need to modify my system files. I know apps are available to do the same thing Android is supposed to do, but I prefer not installing an extra app.
I found the Java file which handles these events. It seems like the problems lies with line 124:
The code seems to only accept events from primary calendar. Imported calendars are not used as primary calendars though...
Okay, so the list of requirements for the Do not Disturb event detection to work seems to be as follows:
- The current time must be greater than the beginning of the event and the current time must be less than the end of the event
- The calendar the event is in must be
- The event availability field must NOT be "free" (so it should be marked as
AVAILABILITY_TENTATIVEor something else, as long as it's not
- It should meet the attendee requirements: the event has an attendee with the same email address as the "calendar owner". This means an attendee value needs to be set for in the iCal file, containing the email address of the Google account the iCal file was imported into.
- The "reply" field must be equal to the option the user selected. This means the attendee status must be
ATTENDEE_STATUS_ACCEPTEDif the user requests to only activate the rule when an event has been accepted,
ATTENDEE_STATUS_TENTATIVEfor "yes or maybe" or anything but
ATTENDEE_STATUS_DECLINEDwhen the user selects "yes, maybe or not replied".
Does anybody know how to pass an imported calendar through this filter? Or how to make a calendar "primary" so the check can succeed?