Google Calendar: Sync recently created calendar within my Google account - oauth

I just played around with the Google Calendar Java API within my Scala Webframework and managed to create a new calendar programatically. After that, I create a new event within that calendar.
My problem is, that the event in the new calendar does not seem to be synced with my client devices (my tablet). However, if I create an event in my "primary" calendar, I immediately see the event on all of my devices.
If I go to https://www.google.com/calendar/syncselect, the recently created calendar is checked. So actually I would expect all events to be synced on my devices.
I'm using the JAVA API within a Scala context:
def addCalendar(serviceCalendar: com.google.api.services.calendar.Calendar): com.google.api.services.calendar.model.Calendar = {
val calendar = new Calendar()
calendar.setSummary("test calendar")
serviceCalendar.calendars().insert(calendar).execute()
}
//...
//code fragment where a new event is inserted into an existing calendar
val credential = new GoogleCredential().setAccessToken(token.get.value)
val calendar = Auth.getCalendarService(credential)
//create a new test calendar
val testCalendar = addCalendar(calendar)
val event = createEvent
//insert new event into "primary" calendar.
calendar.events().insert("primary", event).execute()
//insert event into the new calendar
calendar.events().insert(testCalendar.getId(), event).execute()
Both events appear in the Google Calendar web interface. However only the event in the "primary" calendar is synced.
If I look into the "calendar list" of my Android (Samsung S Planner, Android 4.3.) application, I don't see the recently created calendar as "in sync". (The primary calendar is marked as in sync!).
So I guess this is the reason why I see the "primary event" but not the other one. But actually I would expect Google to send some kind of push notification that a new calendar has been added to the account.
Can I enforce that programatically? Or is it simply a matter of time?

Syncselect only influences iCalendar, iOS and other CalDAV clients. It's not used for Android. In there the toggle for calendar syncing is on the device and AFAIK needs to be done manually.

Related

Muting Email Notifications related to Attendee Responses in Google Calendar API

I added the feature of syncing google calendar with events of my application. But the issue was, the event organizer/creator was receiving emails from google whenever the event attendee responds to the google calendar event. I wanted to receive the email notification for only creation/updation of events. I added the notification_settings and kept event_response method to blank but it didn't work.
CALENDAR_ID = 'primary'
CALENDAR_NOTIFIER = 'externalOnly'
gcal_event = client.insert_event(
CALENDAR_ID,
Google::Apis::CalendarV3::Event.new(gcal_event_params(gcal_event_attendees)),
send_updates: CALENDAR_NOTIFIER
)
-----------------------
// added notification_settings later so that the organizer should not receive event response, but no luck so far.
def gcal_event_params(gcal_event_attendees)
{
summary: event.name,
description: event.description,
location: event.location,
start: { date_time: event.start.to_datetime.to_s, time_zone: org_timezone },
end: { date_time: event.ends.to_datetime.to_s, time_zone: org_timezone },
attendees: gcal_event_attendees,
reminders: { use_default: true },
notification_settings: {
notifications: [
{type: 'event_creation', method: 'email'},
{type: 'event_change', method: 'email'},
{type: 'event_cancellation', method: 'email'},
{type: 'event_response', method: ''}
]
} }
end
Answer:
The notification settings for event creation, change, cancellation and response are settings of the Calendar itself, not the individual events of the Calendar. The notification_settings parameter of Events: insert does not exist, which is why this is not working.
More Information:
I'm not really sure where the writer of the blog that you linked is getting the information, but the Events: insert method of the Calendar API does not have this parameter.
In the user interface at calendar.google.com, you can see the notification settings you are referring to in the settings page for the whole calendar, not for individual events:
For individual events, when the event is created, you can use the sendUpdates parameter to specify who, if anyone, should be notified when the event is created. The same parameter exists as a part of the Events: update method, which lets you set who gets notified of that specific change.
If you want to have notifications set up for the creation, changing and cancellation of events, but not of event responses, then this needs to be set up for the Calendar itself. Unfortunately however, this isn't something that can be done with the API and needs to be set in the User Interface itself.
This does unfortunately mean that what you're looking at doing isn't something that is possible through the Calendar API.
Feature Request:
If this is of interest to you, you can however let Google know that this is a feature that is important for the Calendar API and that you would like to request they implement it. Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services. The page to file a Feature Request for the Calendar API is here.
References:
Google Calendar API - Events: insert
Google Calendar API - Events: insert Parameters
Google Calendar API - Events: update
Google Calendar User Inferface
Google Calendar API - Calendars: insert
Google Calendar API - Calendars: update
Google Issue Tracker - Create a Calendar API Feature Request

SingleValueExtendedProperty is propagated only when room accept the event

I'm doing some code that book meeting rooms integrated with Outlook Office 365.
I'm using Microsoft Graph to do that and my solution requires some extended properties that are used in many functionalities.
My problem is:
When I update the extended properties of some event in the owner's calendar, the change doesn't propagate to the room copy of the event. The extended property is propagated only when the room needs to accept the event again (e.g. start date changes).
Piece of code I'm using to update event:
Event toUpdate = new Event
{
Id = eventData.EventId,
SingleValueExtendedProperties = new EventSingleValueExtendedPropertiesCollectionPage()
{
new SingleValueLegacyExtendedProperty
{
Id = "String {00020329-0000-0000-c000-000000000046} Name SkipBookingCancellation",
Value = "True"
},
}
};
await calendarService
.Users[calendar.Email]
.Calendar
.Events[toUpdate.Id]
.Request()
.UpdateAsync(toUpdate);
It's kinda strange because when I create the event in the owner's calendar, it is propagated through rooms correctly, but when I update the extended property, it works on the original event but it doesn't affect the room's copy (unless the room needs to accept the event again).
Perhaps Graph is missing that old functionality of EWS that informs to the update method to force sending the invitations again, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy.

Fitbit.Net 2.2 Activity log

My project is MVC 5, I am using Fitbit.Net library to access user Fitbit's data. Is there a way to get the activity name and duration?
I tried
var stats = await fitbitClient.GetDayActivityAsync(DateTime.Today, null);
I get the following:
The problem was the logged activity was not one of the common Fitbit activities so it did not show up. However, if the activity is a common, it works.

AWS AppSync multiple subscriptions in same view controller not working - iOS Swift

Just FYI I posted this question originally in the AWS AppSync forum (in case in the future AWS answers it).
I have been trying to make a simple Posts app like the one in the docs but I have found no documentation or guides that handle multiple subscriptions in one view controller.
Three mutations: onCreatePost, onUpdatePost, onDeletePost
(and of course three subscriptions to those mutations)
In Xcode, I have three functions called during viewDidLoad(): subscribeToNewPosts(), subscribeToUpdatedPosts(), subscribeToDeletedPosts()
Each subscription function works and creates a subscription with the correct functionality and updates the table view accordingly if used alone. But, if called one after the other, only the last subscription will actually receive data and update the table view. I put a breakpoint to check out topicSubscribersDictionary in AppSyncMQTTClient.swift after subscribing to all three mutations
func startNewSubscription(subscriptionInfo: AWSSubscriptionInfo) {
var topicQueue = [String]()
let mqttClient = MQTTClient<AnyObject, AnyObject>()
mqttClient.clientDelegate = self
for topic in subscriptionInfo.topics {
if topicSubscribersDictionary[topic] != nil {
// if the client wants subscriptions and is allowed we add it to list of subscribe
topicQueue.append(topic)
}
}
mqttClients.append(mqttClient)
mqttClientsWithTopics[mqttClient] = topicQueue
mqttClient.connect(withClientId: subscriptionInfo.clientId, toHost: subscriptionInfo.url, statusCallback: nil)
}
and all three subscriptions are in fact in the dictionary...
Do I need multiple instances of appSyncClient, one for each subscription? Is it a problem with the schema design?
schema.graphql
schema.json
mutations.graphql
queries.graphql
subscriptions.graphql
Example use case: simple chat app. New conversation started = OnCreatePostSubscription; new incoming message in that conversation = OnUpdatePostSubscription
Are you using API Key for authorization in AppSync? If you are using API Key only one subscription is supported by the SDK at this point. Could you switch to IAM (Cognito Identity) or Cognito UserPools based auth and see if multiple subscriptions work for you?
I managed to have several subscriptions working with API Key by replacing the call startSubscriptions to startNewSubscription inside AWSAppSyncSubscriptionWatcher
if let subscriptionInfo = subscriptionResult.subscrptionInfo {
self.subscriptionTopic = subscriptionResult.newTopics
self.client?.addWatcher(watcher: self, topics: subscriptionResult.newTopics!, identifier: self.uniqueIdentifier)
//self.client?.startSubscriptions(subscriptionInfo: subscriptionInfo)
subscriptionInfo.forEach { self.client?.startNewSubscription(subscriptionInfo: $0) }
}
Couldn't find any side effect with this approach yet, apart from requiring to fork the iOS SKD

Access Exchange Calendar with Exchange Web Services

I want to build a client where I can display events in a given Exchange Calendar.
I read about ActiveSync and Exchange Web Services, and apparently Exchange Web Services is the way to access the calendars, however, I cannot find any documentation on how to go about fetching the data (i.e. how to authenticate with the Exchange server, how to retrieve the data (through HTTP POST requests?), and so on).
Am I on the right track or am I missing a different API that is used to access an Exchange calendar? I would prefer, if I didn't have to use Apple's Event Kit since that would require the user to sync his account with the iOS device first.
EWS is the way to go. You can read any user's calendar (presuming you have credentials or impersonation authority), and can also subscribe to notifications when a calendar changes. EWS can be accessed from .NET apps, Java, and other languages. Of course the easiest way to go would be using C# and the EWS Managed API, but there are a lot of alternatives outside the Windows world. You can start here, but you'll probably want to search for you specific technology. There's a lot of info out there.
In JAVA EWS api , i used below code:
public static void getAllMeetings() throws Exception {
try {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date startDate = formatter.parse("2016-01-01 00:00:00");
SearchFilter filter = new SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.LastModifiedTime,startDate);
FindItemsResults<Item> findResults = service.findItems(WellKnownFolderName.Calendar, filter, new ItemView(1000));
System.out.println("|------------------> meetings count = " + findResults.getTotalCount());
for (Item item : findResults.getItems())
{
Appointment appt = (Appointment)item;
//appt.setStartTimeZone();
System.out.println("TimeZone====="+appt.getTimeZone());
System.out.println("SUBJECT====="+appt.getSubject());
System.out.println("Location========"+appt.getLocation());
System.out.println("Start Time========"+appt.getStart());
System.out.println("End Time========"+appt.getEnd());
System.out.println("Email Address========"+ appt.getOrganizer().getAddress());
System.out.println("Last Modified Time========"+appt.getLastModifiedTime());
System.out.println("Last Modified Time========"+appt.getLastModifiedName());
System.out.println("*************************************************\n");
}
} catch (Exception exp) {
exp.printStackTrace();
}
}
I can get all meeting schedules.

Resources