A workaround for accessing your Google calendar info.
To use this on{X} Recipe, simply copy the code below and modify if needed.
var feed = âhttps://www.google.com/calendar/feeds/your_calendar_path_here/fullâ;
// make sure to use "alt=json"
var params = âalt=json&ctz=UTC&max-results=5&singleevents=false&futureevents=true&orderby=starttime&sortorder=ascendingâ;
// call the feed and get to working
device.ajax({url: feed +â?'+ params,
type: âGETâ,
headers: {âContent-Typeâ: âapplication/jsonâ}
},
function onSuccess(body, textStatus, response) {
console.log(textStatus);
var feed;
if (!(body && (feed = JSON.parse(body)))) {
console.error(âinvalid body formatâ);
return;
}
feed = feed.feed;
var eventCount = feed.entry.length;
console.info(âgot â+ eventCount +â events for â+ feed.title.$t);
// check upcoming events
for (var i = 0; i < eventCount; i++) {
var eventEntry = feed.entry[i];
console.log('event ' + eventEntry.title.$t);
var notification = device.notifications.createNotification('View ' + eventEntry.title.$t);
notification.content = 'Click to open';
// the link is recognized by the device, and can will open the event details on the device
notification.on('click', function() {
device.browser.launch(eventEntry.link[0].href);
});
notification.show();
}
},
function onError(textStatus, response) {
console.error(textStatus);
});
Views