Compass for J2ME
Use your cell phone as a compass. By rotating the phone so that the sun and/or moon icons match their location in the sky, the top of the phone will indicate true north.
Any cell phone or other mobile device with J2ME (Java 2 mobile edition).
- compass.jar (91K)
- via WAP: http://qcontinuum.org/compass/compass.wml
- source code: CompassSource.zip
This older version can be useful for phones with limited memory.
Compass uses henson.midp.Float by Nikolay Klimchuk.
- Fixed failure to load world map on Nokia 3rd edition phones.
- Improved format of info on Nokia phones.
- Reduced size of JAR by compressing world map images.
- Enlarged list of valid time zones for a given location.
- Improved "Please Wait" form with cancel option.
- Restored "Color" display option. Restored display of GTM. New icon.
- User interface reorganized.
- Select location and destination using world map or airport code.
- Automatic daylight saving time adjustment.
- Load and save favorite locations or destinations.
- Display heading, distance, and local time of destination.
- Set arbitrary date and time.
- 12 hour or 24 hour time display option.
- "Prayer Focus" feature deprecated (replaced by "Destination").
- "Color" display option deprecated.
- Displays times of sunrise, sunset, sun transit, moonrise, moonset, civil twilight, nautical twilight, and astronomical twilight.
- Phase of moon indicated by crescent shaped icon.
- Improved calculation accuracy.
- Enter 3 or 4 letter airport code to indicate position instead of latitude and longitude. Airport database contains over 3000 airports, but consumes only 21K.
- Latitude / longitude entry is still permitted, and the problem with negative number entry is avoided by selecting North / South and West / East.
- Shows the great circle heading towards locations of religious significance. This feature provides the appropriate direction to face while praying for people of various faiths.
- Orientation options allow the screen to face down rather than up, and the top of the phone can point toward the sun or moon rather than North.
- Display options allow the color of the display to be selected. Different colors are available for day and night.
- Menu provides "Help" option to describe each selection.
- Display is automatically updated every 10 minutes.
- Displays "No Sun or Moon" if neither is present in the sky.
- Source code organization significantly improved.
Q: How does it work?
A: Compass computes the sun and moon position using your latitude and longitude, and the time.
Q: Why do I need to select my time zone?
A: Compass knows your local time from your phone's real time clock, but astronomical computations need GTM (Greenwich Mean Time). By selecting the time zone, Compass can compute GTM from your local time.
Q: How can I find my airport code?
A: Use the World Airport Codes web site.
Q: How do I know if my phone supports J2ME?
A: Consult the phone manufacturer's web site for specifications on your phone. Or start a game on your phone, and look for a "Java Powered" splash screen.
Q: How do I load this software on my phone?
A: Here are 4 possibilities:
- Start your WAP browser and enter the address qcontinuum.org/compass/compass.wml
- Start your WAP browser and enter wap.getjar.com, select "Quick Download", enter code 12347.
- If you have a cable to connect the phone to your PC, then use your phone vendor's software to copy compass.jar to the phone.
- If your phone is Bluetooth capable and supports OBEX file transfer, you may be able to use OBEX to copy compass.jar to your phone.
Q: How does Compass translate an airport code to the
associated latitude / longitude?
A: Compass contains a database of 3000 global airports. The database is stored in a very efficient manner which requires only 21K of memory. The data was derived from the Global Airport Database. See a world map of the airport database.
Q: What algorithms does Compass use to perform
A: The calculations are based on algorithms from the book "Astronomy on the Personal Computer".
Q: Thanks for the source code. Can I use it in my own
A: Yes, if you follow the terms of the GNU General Public License.
Because this software is free of charge, there is no
warranty. It is provided "as is" without warranty of
any kind, either expressed or implied.