How to fetch tasks from android calendar? - android

I am working on calendar application and i search on this issue "how to get all tasks from android calendar not from google calendar" but i got that it is not possible to fetch tasks from the calendar.can anybody tell me is it true or false? in case of false please help me to getting tasks from calendar in android.
I am using inbuilt sPlanner not google calendar.

Tasks is not part of Calendar. However, you can use the Tasks API to accomplish this under the right circumstances.
By default, there's no identifier for whether or not a Task is associated with your Calendar or not. Two easy ways of creating such an identifier would be to either include some sort of key in the description or create a Task List exclusively for Calendar tasks.
If using a key, just retrieve all the tasks and pick only ones containing your key. If using an exclusive Task List, just list all the tasks from the specific list.
Also the calendar being on Android also should not matter here. The Android Calendar app just displays a Google Calendar.

Related

How to get reminders list programmatically?

I created an Android app that read all the events of the calendar, it's work fine but I can't read the list of reminders: the simplified event in the Google calendar identified by this icon (knot on the finger)
Google Calendar Reminder
Someone can tell me how can I read this type of event or where can I find a tutorial or a guide where this is explained?
If you want to fetch list of reminders, use Events.list. It returns events and the accompanying reminders.
Default reminders
Default reminders are also returned when
doing an Events list query.
I discovered that the reminders aren't only on calendar but are in different Google app (keep for example).
Unfortunately it's not possible to access a this kind of data.
This the link of the answer in Stackoverflow: How to read reminders in google calendars
According to OferR The Reminders data is held in a database and accessible by the 'com.google.android.gms.reminders.provider.RemindersProvider' content provider.
So, the provider is not exported and therefore is not accessible to third party apps.

Looking for something like DatePickerDialog but with a recurrence function

I'm new to Android development, and I am trying to build an app that has a task list with items that recur at a user specified frequency. I would like the user to select the first due date for the task, and also specify the frequency for the recurrence, similar to how you can do this for events in Google Calendar (I am currently using a DatePickerDialog to allow the user to select a due date; I am just missing the recurrence piece). However, I do not want to put events in the calendar using the calendar API. I have searched StackOverflow and have come up empty; I see plenty on the calendar API but don't believe this is what I am looking for (since I don't want to put anything in the user's calendar); is this a correct assumption? Is there a class that I have missed that handles recurring dates? Or, is there a simpler way to go about this?
I was looking for pretty much the same thing and I ended up using BetterPickers library. There are various dialogs you can use and one of them is also a RecurrencePickerDialog which looks a lot like the one in Google Calendar app.

How to implement CalenderView in Android

I am new at android this, so this might sound a bit confusing..
i am making an app that requires to have calendars showing events in week, day and month views (like google calendar). I have implemented this is a testing version but i want to change the implementation to make it more flexible. currently the event are stored in database and are edited and used in various activities in the app. Can i have android manage the events in it's calendar? but i would still need to be able to manipulate it from the app and store extra info other than the time and date and description. These extra info will be used for calculations. We also need to have a calendar in the app. Can we retrieve the events specific to the app for doing all this?
This tutorial might be of help.

Android Calendar Provider Sync - SYNC_DATA columns?

I'd like to sync between the internal Android calendar and my application.
I'm using CalendarContract available from Android API 14 onwards.
Any change of the content provider "com.android.calendar" calls onPerformSync(..) of my sync adapter.
However, at this point, all the rows of the events are set DIRTY = 0.
That means, the Google calendar sync must have set the DIRTY FLAG to zero before my sync adapter can access them.
CalendarContract.EventsColumns.SYNC_DATA1 - SYNCDATA10 are said to be columns of the content provider for use with sync adapters.
Does anybody know if there is some convention for what is the use of these columns?
I've realized that on my device SYNC_DATA5 stores the date last modified and SYNC_DATA1 seems to store the Google event ID. So it seems whenever the Calendar app syncs with Google Calendar, these columns are modified.
However, if I choose to use one of these columns for my sync adapter, how can I make sure another application doesn't use the very same columns and they override each other?
If SYNC_DATA5 is ALWAYS used by Google Calendar to store the date last modified I would be fine with just using that for my sync logic, I just need to be certain that this is a convention.
The SYNC_DATA columns can be used for any value. I'm not sure on how the google calendar does that, but they are intended for stuff related to your sync adapter, applications not syncing the calendar must not use them. So you're safe to use any column (given you don't change it between versions of your application, or you'd have to write migration code), as there should not be any other sync adapters working on your calendar.
You can not rely on the SYNC_DATA columns when not being a sync adapter, do not use them when the calendar is not "yours".
However, I have a strong feeling you're not syncing properly. To sync a calendar, you must use a separate calendar, not any calendar synced by google or any other third party app. I'll also list some other steps involved which I think you performed, but may be helpful to others.
You also need to append some parameters to any of your requests for the system so you get access to the sync adapter fields. Also, you should sync your calendar from an AbstractThreadedSyncAdapter implementation only. For that, you also need to provide an authenticator, if you have none yet (so the user will be able to enable/disable your sync adapter in the sync preferences of an account). An overview on the sync adapter thing can be found in this blog post.
If you don't have server-side accounts and only one calendar, you need to do some stuff when starting up for the first time:
Create an account
Create the calendar bound to that account
Enable your Sync Adapter
After that, Android will take care of executing your sync adapter from time to time, and you can access the SYNC_DATA columns without collisions (in the calendar you created) and DIRTY flags are served properly.

sync custom events to default phone calendar in android

i have an application in which i need to sync the events that i get from an xml to the default calendar provided in the users phone.
for the above i have referred this tutorial.But over here the first it is required to get the id and name of all the available calendars in the users phone... i don't know the id and name of the default calendar in the users phone....which calendar should i use to put events in?
i am not putting the code here as the code is present in the link given.
thank you in advance.
You can't know ahead of time. There is no system setting for the default calendar. You must account for this in your application by allowing the user to select the calendar or coming up with your own way of determining the "default".
Be careful not to rely on the persistence of any calendar because if they are Google calendars they will come and go with corresponding changes in the cloud.

Categories

Resources