How can I get sun rise and sun set times for various locations?
===

I am planning to develop an application for which I need to know the sun rise and sun set times of any day (in atleast an year complete) depending upon the place (zone/city). 

Considering that I need to develop such an application for Android and also for a desktop application, I would like to know if there are any APIs or libraries for the same that could help me get these data easily. 

PS: Though I mentioned both Android and desktop, the preference is more for the former but it would be nice to use an API that is compliant for both.