Hi Martin
I'm creating a custom widget with clock and other additional information, is there a way to get the next alarm time and next calendar event info?
Thanks
Custom widget with next alarm & calendar event
Moderator: Martin
Re: Custom widget with next alarm & calendar event
Hi,
Next alarm can be queried using action Init Variable System Setting and next_alarm_formatted.
Next calendar info can be queried with action Query Content Provider, however this action is quite difficult to use. There's an example to query the current calendar events. You could increase the time range in the content uri ...instances/when/{triggertime}/{addDays(triggertime,3)} to read the events of the next three days and limit the selection to begin>{triggertime} to ignore events that already started and sort order to end (untested).
Regards,
Martin
Next alarm can be queried using action Init Variable System Setting and next_alarm_formatted.
Next calendar info can be queried with action Query Content Provider, however this action is quite difficult to use. There's an example to query the current calendar events. You could increase the time range in the content uri ...instances/when/{triggertime}/{addDays(triggertime,3)} to read the events of the next three days and limit the selection to begin>{triggertime} to ignore events that already started and sort order to end (untested).
Regards,
Martin
Re: Custom widget with next alarm & calendar event
great!
I tried and both actions are working properly, with Automagic you can really do all!!
I tried and both actions are working properly, with Automagic you can really do all!!
Re: Custom widget with next alarm & calendar event
@nicsergio: thanks for asking this question
@Martin: thanks for answering it
I want to add my solution for 'get next event' which maybe of use for others...
@Martin: thanks for answering it
I want to add my solution for 'get next event' which maybe of use for others...
Re: Custom widget with next alarm & calendar event
the trigger is a calender event
(if an event starts - what is the next event?)
(if an event starts - what is the next event?)
- Attachments
-
- 2014-11-25 08_55_10-Screenshot_2014-11-25-08-44-13.png - IrfanView (Zoom_ 380 x 675).png (100.76 KiB) Viewed 18889 times
Last edited by AMChris on 25 Nov 2014 08:07, edited 1 time in total.
Re: Custom widget with next alarm & calendar event
now we query the calender
- Attachments
-
- 2014-11-25 08_54_22-Screenshot_2014-11-25-08-44-38.png - IrfanView (Zoom_ 418 x 742).png (121.95 KiB) Viewed 18889 times
Re: Custom widget with next alarm & calendar event
second part of the 'query'
(I aks for a whole table because I want to get more information than only the title)
(I aks for a whole table because I want to get more information than only the title)
- Attachments
-
- 2014-11-25 08_54_50-Screenshot_2014-11-25-08-44-44.png - IrfanView (Zoom_ 380 x 675).png (91.96 KiB) Viewed 18889 times
Re: Custom widget with next alarm & calendar event
now I use a script to extract the content
Code: Select all
/*
SELECT title,begin,calendar_displayName,end,eventLocation
FROM content://com.android.calendar/instances/when/{triggertime}/{addDays(triggertime,3)}
WHERE begin>{triggertime} ORDER BY begin
*/
global_next_event_title=getElement(getElement(event_table, 0),0);
global_next_event_begin=getElement(getElement(event_table, 0),1);
global_next_event_calendarName=getElement(getElement(event_table, 0),2);
global_next_event_end=getElement(getElement(event_table, 0),3);
global_next_event_location=getElement(getElement(event_table, 0),4);
global_next_event_day="";
if ("{global_next_event_begin,dateformat,yyyyMMdd}"!="{getDate(),dateformat,yyyyMMdd}") {
global_next_event_day=left("{global_next_event_begin,dateformat,E}",2);
}
- Attachments
-
- 2014-11-25 09_19_39-CC-Posteingang - Sven.Hofians@inhouse.wko.at - Microsoft Outlook.png (22.2 KiB) Viewed 18888 times
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
Re: Custom widget with next alarm & calendar event
Hi AMchris, why don't you share your flow with us?
Would appreciate it
Best regards AngelAtwOrk
Would appreciate it
Best regards AngelAtwOrk
Best regards,
AngelAtwOrk
AngelAtwOrk