Adding exceptions to recurring events in android < version 4.0 - android

Microsoft Office Project 2007 introduces effective work weeks and
calendar exceptions, where all calendar data is associated with a set
of "valid from/to" dates.
--Microsoft Office Dev Center
Google also uses this feature.
Does Android Calendar (pre-ICS) support these features too? I tried Googling, but only found incomplete posts, such as https://stackoverflow.com/questions/13633577/android-8-sdk-14-recurring-event-exception.
I learned on a separate post that the way to access the calendar was through a content provider, however I have found no working solution
(for example, I tried using "content://com.android.calendar/exception", but it results in an exception saying that it is an unknown url).
Any help to steer me in the right direction would be extremely helpful, as I have been Googling to no avail, and this try and try again stuff is not working well.

No. Android Calendar exceptions are officially supported starting with ICS (API level 14):
-- Android Developer Guide
Some versions may allow you to use the Uri you discuss, since it is derived from the source code:
public static final String AUTHORITY = "com.android.calendar";
public static final Uri CONTENT_EXCEPTION_URI = Uri.parse("content://" + AUTHORITY + "/exception");
//hence, CONTENT_EXCEPTION_URI = Uri.parse("content://com.android.calendar/exception");
however since it is not officially supported, it should not be considered reliable.

To answer your first question, yes, older Android has ability to have exceptions to a repeating event.
Since that API was introduced in API 14, It's probably a lot different than the previous versions' code. This link has some hints on getting events from calendars on older versions.

Related

Date/Time manipulation in Android without java.time

I'm writing an Android app that relies heavily on checking whether a given moment in time belongs to a certain time range. Usually I would use the java.time library, however this limits my app to API 26 or higher. It is absolutely necessary that my app runs on devices using at least API 16. Everywhere I look on the online documentation and forums I find only references to java.time, how can I perform these kind of checks in a backward-compatible way?
Edit: after some more research I found the proper way to do it through gradle desugaring.
One of the way to manage dates and times in Android is adding Joda Time Android. It provides concise, flexible and easy API for replacing standard time API. Hope it'll be helpful.

Any Example of Android Public API being removed

I was going through the Android documentation and I came across below lines:
In a very small number of cases, parts of the API may be modified or
removed, although typically such changes are only needed to ensure API
robustness and application or system security.
Is there an example of such removal of public API?
It would be interesting insight for all of us, developers, to understand why an API is removed and what can possibly be removed in Future based on this previous history.
The Apache HTTP client was deprecated in API 22 and removed in API 23. In this case it appears that they only removed it from the stub library, so apps using it will still run on Android M. You just can't compile them for Android M.
Google has also effectively removed features by changing the way APIs work. An example of this was the change to ActivityManager#getRunningTasks(int) in API 21. The method is still there, but it no longer allows you to discover what other apps are running, which is what many developers were using it for. Another example is how network activity on the main thread started throwing a NetworkOnMainThreadException in Android 3.0. In both of these examples, the documentation described the intended use of the API long before they began enforcing it.

Edit/delete calendar event in Android API < 4.0 - should I do it?

My app has a built in feature for creating in-app reminders, and it needs to support at least API 8 (Android 2.2). There is no problem adding a calendar event, but the problem begins when the user edits the reminder date in-app and expects that the calendar event related to the app data will change too.
Also, the app data is synchronised with a server, so I maybe should delete all old events from my app when syncing and re-create the new ones. But to do that I'll need to find the events that have been created by my app and I'm not entirely sure how I can find them (maybe by time and event title?)
From what I understand, editing or deleting calendar events is not officially supported in Android versions prior to 4.0, so it might not work on all devices, etc. Should I just tell my client that we should just support events in Android 4.0+?
Should I just tell my client that we should just support events in Android 4.0+?
IMHO, yes.
Note Questoins like should I ... yes/no are likely opinion based question that belongs to https://softwareengineering.stackexchange.com/ and are likely to be closed on http://stackoverflow.com.
If your question is how to use calender in android versions below 4.0 you can look at
Jim Blackler's Accessing the internal calendar database inside Google Android applications
where you basically query contentproviders where url and fields may differ depinding on manufacturer and android version (ie content://calendarEx or content://calendar or content://com.android.calendar). This is slightly different from the official android 4 api.
So you have to encapsulate this logic yourself and be prepared that it will not work on every prior andriod 4.0.

Android, List events from specific calendar (on Phone (?))

I want to show a ListView with the events of the current day from a specific calendar. The calendar is originally fetched from a .ical file and synchronized into my google account. And yes, I've searched.
Should I go with the content:// stuff?
Im using Android 2.2 and above.
One option would be to use the Google Calendar API functions. On the surface it seems like tons of work, however you are mostly importing (Build Path) their jar files and making the appropriate imports and method calls.
http://code.google.com/apis/calendar/v3/getting_started.html
This turns into HTTP requests and the like, which implies you must always be connected to the network (I'm not a fan of that).
Officially supported or not, I am working on an application that is working with the local phone calendar database and doing what I need to do there (yes, the content:// URI stuff you mentioned above).
Either way, you can do what you are needing to do as your application seems simple enough. Most people, and rightfully so, will tell you to use the Google Calendar API imports/calls because it is supported functionality that does not rely on how the device manufacturer chose to implement the back end content provider. Although every phone I have tested uses "content://com.android.calendar/events" as the URI, that does not mean that it will always work as that can change (and has in the past) based on the version of Android running on the device.
Android 2.1 and before: content://calendar/calendars
Android 2.2 - 2.3: content://com.android.calendar/calendars

Deprecated API Android and Iphone

I am making application which is using a deprecated API. I have to submit it on Apple and Android App Store next month.
In this case, is there any chances to reject the application from app Store of Iphone And Android.
Don't use a deprecated API. Almost nobody deprecates something without providing an alternate means to accomplish the same task. Use the documentation to discover these alternatives, and adjust your code accordingly. What happens if iOS 5 comes out tomorrow, for instance, and all of a sudden your code breaks on those devices. You'll be scrambling to fix it. Fix it now while you have some time.
Android should not be a problem due to the fact that they won't look at your code. Apple will probably check your code and if they see it, they will most likely tell you that you are using deprecated API, but I don't think they will reject it if it is working flawlessly with it.

Categories

Resources