Logo Computer scientist,
engineer, and educator
• Software

SunTimes logo

SunTimes for Android

SunTimes is a trivially simple Android app that displays the Sun and Moon rise and set times for a specific day. It is intended for small displays, and should work with more-or-less any Android device currently available.

There's no shortage of similar apps available; I couldn't find one without ads that I could get for free, so I wrote my own.


SunTimes isn't ever going to be on the Android Market (or whatever it's called these days). To install, download the APK file (see below), copy it to the device, and install with a file manager like Astro.


It's self-explanatory, I hope. You'll need to set your location, which you can do as latitude and longitude, or have the device do its best to work it out. Timezone is taken into account automatically, and all times are local, including daylight savings where appropriate.


On installation, SunTimes asks for permission to read your location from the network. In fact, the program will only do this if you specifically tell it to (see below). But Android does not provide a way to asign permissions at run-time, so you'll have to grant this permission at install time if you want use SunTimes. Sorry, this is a limitation of Android system, not SunTimes. SunTimes screenshot

On the 'set location' screen there is a button to allow the program to attempt to get your location from the network (wifi or cell). The precision is usually good enough for normal uses, and this method uses much less battery power than GPS. However, the method will fail if location by network is disabled on the device (see, typically, Settings->Location on the launcher).

Because the network location may not always be accurate, SunTimes will not apply it automatically. The stored value for location, whether you entered it manually or it was determined by the device, will always be used unless you specifically tell SunTime to read location from the device again. This makes the program minimally invasive (i.e., it won't eat your battery without your knowing about it), but it does mean that you need to remember to fetch a new location if you travel.

Note — you can set a longitude and latitude as far away from your home location as you wish. However, the time will always be displayed as a local time, as determined by your handset's timezone setting. My experience is that most handsets do not adjust their timezones automatically. What this means is that, if you travel, even though SunTimes may know your exact location, it will still produce wildly inaccurate results unless you set the handset timezone correctly.

The main screen only displays location to a precision of one minute (one 60th of a degree). You can enter more precision than this if you wish, and the added digits will be used. However, sunrise/set times do not vary so much with location that sub-minute precision is really needed. The algorithm used to calculate moon rise/set times is iterative, and is generally only accurate to within a few minutes anyway.


Android APK file
Source code
Copyright © 1994-2013 Kevin Boone. Updated Feb 08 2013