Google Calendar return the result to Activity - android

Is it possible to get the selected event's result to Activity using Google calendar?
I'm using startActivityForResult to open the google calendar from my application, I would like get the selected event's details in my application on onActivityForResult method. Is it possible to override the select event in google calendar?

You can use the Google Calendar API to find and view public calendar events.
The Calendar API lets you display, create and modify calendar events as well as work with many other calendar-related objects, such as calendars or access controls.
GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events
import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.model.Event;
// ...
// Initialize Calendar service with valid OAuth credentials
Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials)
.setApplicationName("applicationName").build();
// Retrieve an event
Event event = service.events().get('primary', "eventId").execute();
System.out.println(event.getSummary());
I believe you might find Google Calendar API really useful.
Reference Link https://developers.google.com/google-apps/calendar/v3/reference/events
This might be help you.Good Luck

Related

Screen tracking support - Firebase 9.8

According Firebase Android SDK Release Notes with 9.8 update we have screen tracking support with android screens and activities... The documentation says that this event works like that:
mFirebaseAnalytics.setCurrentScreen(activity,class_name,class_override_name);
In my case, I don't need overrides class name and I send null value... But i'm waiting 48h and my firebase analytics console doesn't show info about this event, any ideas?
Thanks in advance!
Another very important thing that I've noticed only after two days of intensive struggling: the setCurrentScreen method MUST be called on the UI thread.
I was only able to see that after looking for a light in the Firebase decompiled code:
#MainThread
#Keep
public final void setCurrentScreen(#NonNull Activity var1, #Size(min = 1L,max = 36L) #Nullable String var2, #Size(min = 1L,max = 36L) #Nullable String var3) {
//...
}
Whenever this method is called a event of type screen_view is logged.
And keep in mind the Firebase size restrictions. The maximum size of a screen name is 36 characters long.
First I had the same question: where is my event with current screen name on the Firebase dashboard?
I've called method mFirebaseAnalytics.setCurrentScreen(this, "MainActivity", null); with no result.
Thanks to the comment by Benoit I realized that this method indicates the value of implicit parameter that is automatically attached to any event you send.
That means it's not independent event, it's a parameter that will stick to all your events since you set it.
This will be useful if you have changing screens within single Activity. For example when you have multiple fragments with one hosting Activity. And you call this method in each fragment in onResume().
If you want to have distinct metric with the name of your screen - fire explicitly a new event for that.
Bundle params = new Bundle();
params.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "screen");
params.putString(FirebaseAnalytics.Param.ITEM_NAME, "MainActivity");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, params);
val bundle = Bundle()
bundle.putString(FirebaseAnalytics.Param.SCREEN_NAME, "YOUR SCREEN NAME")
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW, bundle)
Also Firebase Analytic's screen tracking is automatic. No need for explicit separate event tracking.
Sets the current screen name, which specifies the current visual context in your app. This helps identify the areas in your app where users spend their time and how they interact with your app.
Note that screen reporting is enabled automatically and records the class name of the current Activity for you without requiring you to call this function. The class name can optionally be overridden by calling this function in the onResume callback of your Activity and specifying the screenClassOverride parameter.
If your app does not use a distinct Activity for each screen, you should call this function and specify a distinct screenName each time a new screen is presented to the user.
The name and classOverride remain in effect until the current Activity changes or a new call to setCurrentScreen is made. I will try to add this method to onResume Method. I do not know the result but i will share my experience.
firebaseAnalytics.setCurrentScreen(activity,screeenName,activity.getClass().getSimpleName());
firebaseAnalytics.setMinimumSessionDuration(100L);
params = new Bundle();
params.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "screen");
params.putString(FirebaseAnalytics.Param.ITEM_NAME, screeenName);
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, params);
Try using setCurrentScreen as well as manual event fire as firebase doesn't send data immediately to the console...but if event is fired up..all the remaining data is sent to firebase..
Just call that method in onResume(), and check the tracking through DebugView. it worked for me.
Check out the documentation.

Cannot fetch ExtendedProperties, existing in an event Android calendar

Synchronisation is made between Android calendar and my Exchange account,
initially i have created event from Outlook with extended properties, then when i'm fetching those extended properties in Android calendar using the snippet below:
cursorExtendedProp = context.getContentResolver().query(Uri.parse(ExtendedProperties.CONTENT_URI.toString()),new String[] {ExtendedProperties._ID, ExtendedProperties.NAME, ExtendedProperties.VALUE}, null, null, null);
while (cursorExtendedProp.moveToNext()) {
cursorExtendedProp.getString(0);
cursorExtendedProp.getString(1);
cursorExtendedProp.getString(2);
}
cursorExtendedProp.close();
I didn't not get the extended propreties created initially from outlook.
did i miss something ? need some help.

can't reach gui element using Timepicker

I followed the guidelines on google: TimePicker
I created a new class TimePickerFragment, but in my onTimeSet method I can't reach the gui element to update the picked time.
any ideas?

Android Calendar API - edit/delete one event in a recurring series

I can add and delete a new recurring event, but how can I edit/delete one event in a recurring event using the new Android Calendar API? And if it is possible how do I update a reminder on one event?
Regards Daniel
Maybe this will help:
// First retrieve the instances from the API.
Events instances = service.events().instances("primary", "recurringEventId").execute();
// Select the instance to edit
Event instance = instances.getItems().get(0);
if(youWantToCancel) {
instance.setStatus("canceled");
instance.setReminders(yourReminders);
Event updatedInstance = service.events().update("primary", instance.getId(), instance).execute();
}
if(youWantToDelete){
instance.setId("ToBeDeleted")
service.events().delete("primary", instance.getId()).execute();
}
If you want to delete multiple events within a recurrence, simply set the ids to some obvious string like "ToBeDeleted" and perform: service.events().delete("primary",
"ToBeDeleted").execute();
See docs

How to get calendar event updates on Android device?

I want to get calendar event updates (when a new event is added or an existing event is deleted ) on android 2.2 devices ?
In other words, my program wants to get notifications for any calendar event changes
Anyone has any thoughts regarding how to do this?
whenever the Calendar update is made,u can get notification by using Content Observer,u have to register first observer using
this.getContentResolver().registerContentObserver(uri, true, observer);
where uri is the the calendar uri like "content://com.android.calendar/events" and observer is the object of the class extending Content Observer which overrides on change method,invoked when the change occurs
you have to notify this observer using
this.getContentResolver().notifyChange(eventsUri, null)
wherever u r performing changes like in read or delete operation of the calendar

Categories

Resources