Which event data format should use? - iphone

I have an application that (among other features) has an event calendar. Some users need to export and import event data to their own calendars. I've found the iCalendar format, but I don't know if that's the most suitable format for me.
The format should be an extended format (as much as possible to reach the maximum number of users), particularly it must be a format that allows import/export of iPhone and Android calendars (the built in calendars).
The event data itself is very basic (name, description, start and length).
Is there any format that fits these requirements? Is there any way to make an iPhone/Android phone to import/export events in the iCalendar format?

Yes iCalendar is the standard that you are looking for (for more information you can go to http://calconnect.org/ )
regarding exports:
iCalendar is a standard that is based on apple calendar sor iPhone is compatible with icalendar and since this is the de-facto standard for calendaring so is Android compatible.

Related

Are there differences between ics files for Apple and MIcrosoft?

I am creating an html form that accepts calendar event inputs, and returns an ics file. Are there any parameters of an ics file that are different between Apple and Microsoft devices?
Welcome to Stack.
No, no platform specific parameters are required to be provided to be read by an external platform. Of course if you mean parameters to URL, you can offer what you want - they become part of the URL for that ics calendar feed.
If you producing an ics file then you should familiarise yourself with https://www.rfc-editor.org/rfc/rfc5545 or https://icalendar.org/RFC-Specifications/iCalendar-RFC-5545/. The RFC 5545 ics specification is platform agnostic. It allows for private non-standard properties which can be (usually are) platform specific See
https://www.rfc-editor.org/rfc/rfc5545#section-3.8.8.2
https://en.wikipedia.org/wiki/ICalendar#Calendar_extensions
Apple of course has the unofficial uri webcal. See https://en.wikipedia.org/wiki/Webcal. It is not necessary to offer that. Apple does handle the standard http/s protocol with Mime type text/calendar and suffix .ics.

Multiple calendars in one ics file

I have a website that has resource data that can be exported as calendars ( .ics files). It is an internal website and so the users will likely be loading them into Outlook 2013 so that they can cross reference the resource data with their own calendars.
I have run into the challenge that users can easily export multiple sets of data in one go resulting in multiple calendars being available to be download (the common worst case being 12 calendars, but there are going to be a few users who will push it well beyond that). I can easily zip the ics files up and provide the zip as a single download, but my goal is to keep it at simple to use as possible for the user to import into Outlook. From the research I have done and my own tests I have not found any way for .ics to have multiple calendars in one file. As such here is my chain of questions:
Does icalendar have a way of storing multiple calendars in a single file?
If not is there a different calendar file format that Outlook 2013 can import and parse that does support multiple calendars?
If there is no better calendar file type for this, is there a general best practice for providing multiple calendar files for download and import?
I'm not sure exactly what you mean when you say "calendar", but, to expand on #jgm's answer, the specification allows more than one VCALENDAR component to exist inside of the same file.
BEGIN:VCALENDAR
...
END:VCALENDAR
BEGIN:VCALENDAR
...
END:VCALENDAR
According to the specification you can have multiple calendars in a single iCalendar entry:
The Calendaring and Scheduling Core Object is a collection of
calendaring and scheduling information. Typically, this information
will consist of an iCalendar stream with a single iCalendar object.
However, multiple iCalendar objects can be sequentially grouped
together in an iCalendar stream.
However, you would have to test each client individually to see if it was supported as this is not a common situation.
No. The iCalendar format has no notion of calendar "containers". The closest would be to use the CATEGORY property to distinguish between different types of events.
If you really only care about Outlook, the alternative would be to create PST files, which can contain arbitrary hierarchies. But generating those is much more involved in terms of development.

How do I obtain a list of audio formats that the current browser can decode via the web audio API?

I'm using the web audio javascript API? If I loop through several popular audio formats, and then call document.getElementById('someAudioTag').canPlayType('audio/ogg'); for each format (in this case, ogg), do I get a list of audio formats that I can feed into decodeAudioData?
Is there a more straightforward method to get the list of supported formats via the web audio API?
That's pretty much the only way, I think, aside from incorporating a table like this one (note that that's the formats supported by <audio> and <video> tags, which is not quite the same as supported by the Web Audio API; for example IE doesn't have Web Audio at all yet).
You're likely to get a result of "maybe" on a lot of formats, at least if you don't specify a codec (and I haven't figured out exactly how to specify a codec yet-- I hope someone else can chime in).
WebAudio does not provide any way to determine what formats are supported by decodeAudioData.

What to do with CSV after export on the iPhone?

One of the requested features for my apps is to have an export feature. Most of the time the data is table-like in nature. As an example, users might enter every day what types of food they ate that day, and how many portions of each food type. As the data is table-like, I figure the most useful for export would be into CSV format. Then it can be read in spreadsheet software.
I'm confident I can get the data into a CSV like format without too much trouble, and found this post would should help me: How to convert data to CSV or HTML format on iOS?
What I'm wondering about is what I can do with the file once it has been created? Can I attach it to an email? How else can I make it available to the user so that it has some use?
Alternatively, am I going about this the wrong way and would there be a better way to offer an export function?
I would suggest using MFMailComposeViewController and attaching your CSV file to it. This has the benefit of allowing the user to forward to the file to multiple recipients, customize the email body etc. You can also insert HTML into the email body, so if the data isn't too large you could simply present a table of the information within the email itself.
To send an attachment follow the instructions here.
Usually when an iPhone app needs exporting functionality you have the following options:
Attaching it to an email (as you mentioned)
Sending it to a server (with HTTP or any other TCP/IP based protocol)
Exposing it with a small WebServer you code inside your app (like the Video Camera APPs for 3G and older iPhones do)
Unfortunately, you can't use iTunes for sync your exported file. At least you can't with the current version of the SDK.
Instead of CSV, I would use XML. It can also be read with Excel (or any other spreadsheet), plus you won't have to deal with COMMA (or any other separator for that matter) escaping.

iPhone: Looking for an API to store survey results

In my iPhone app I am trying to gather feedback on my game via an optional survey. I would like to send this data to a central server, where I could gather all the statistics and process them to have a bar chart or other convenient presentation.
The data being sent an integer representing the user's preference. ie) Given "How did you like our game?", the user could select from a button from :) :\ :( . Eventually I would also like to have audio feedback where the user could record their voice. The variable length sound clip would be sent and stored from an iPhone to some server, for playback later.
Has anybody done something similar? Google Spreadsheets offers an API which I can't make heads nor tails of but I think it will support a tally of responses. ie) I received 10 goods, 4 neutral, and 7 poor ratings. As far as I can tell I wouldn't be able to store a sound clip in a spreadsheet.
I also looked into Google App engine but if possible I'd like to avoid the networking code to transmit the survey data and the server side scripts to interpret the data. Can somebody recommend a simple API that I could use to store integers for viewing? Ideally I'd like to say something simple like
if (response == "Good") MyGoogleSpreadsheet.MyAppStats.Increment(positiveResponseTallyCell);
Later on I'd just log into Googlespreadsheets and the results would be there for me to read. By the way I don't have to necessarily use a spreadsheet. I just want this to be easy. Bonus points if the API supports the storage and playback of sound but integers will suffice for now.
You can do this with the Flurry API (flurry.com) which lets you specify which custom events to log, and gives you charts and downloadable CSV. Very easy to use:
[FlurryAPI startSession: flurryID];
[FlurryAPI logEvent:#"QUESTION1" withParameters:#"Good"];
Although Flurry is made for general usage statistics gathering, I think it would be a quick and easy way to accomplish what you want.
I know you said you've already taken a look at the Google Spreadsheets API, but you may not have seen the GData Objective-C framework which includes support for reading/writing to and from Google Docs spreadsheets (via the GDataServiceGoogleSpreadsheet class).