Skip to content
This repository

Java ME Compass example targeted especially to Series 40 GPS enabled devices. This is a simple application to demonstrate GPS features in Nokia devices.

branch: master
Octocat-spinner-32 .settings Initial commit November 26, 2013
Octocat-spinner-32 dist Initial commit November 26, 2013
Octocat-spinner-32 doc Added wiki images November 26, 2013
Octocat-spinner-32 nbproject Initial commit November 26, 2013
Octocat-spinner-32 res Initial commit November 26, 2013
Octocat-spinner-32 src Initial commit November 26, 2013
Octocat-spinner-32 .classpath Initial commit November 26, 2013
Octocat-spinner-32 .mtj Initial commit November 26, 2013
Octocat-spinner-32 .project Initial commit November 26, 2013
Octocat-spinner-32 Application Descriptor Initial commit November 26, 2013
Octocat-spinner-32 Licence.txt Initial commit November 26, 2013
Octocat-spinner-32 README.md Updated README.md November 26, 2013
Octocat-spinner-32 build.properties Initial commit November 26, 2013
Octocat-spinner-32 build.xml Initial commit November 26, 2013
README.md

Compass JME

This Java ME application demonstrates the Location API and Scalable 2D Vector Graphics API features on the Series 40 devices.

The example is a simple compass which shows the direction of North and the direction of a selected landmark. The user can also add the current location as a landmark.

1. Prerequisites

Java ME basics

2. Important files and classes

  • src\..\CompassView.java
  • src\..\LandMarkManager.java
  • src\..\LocationFinder.java
  • src\..\LocationListener.java

  • res\compass.svg

  • res\navi.svg

Classes: LocationProvider, Location, LandmarkStore, Landmark, SVGMatrix.

3. Design considerations

The application calculates the direction by requesting the course. This means that the correct direction is not immediately shown and the user has to walk a bit for the GPS to get the proper course. This is done because current Nokia phones don't implement the orientation features in the Location API.

When the GPS polling is running, the application uses quite a lot of power. To prevent excess power consumption, the application stops the polling when the backlight goes off or the screensaver goes on. The polling begins again when the backlight goes on or the screensaver goes off.

The SVG images that are manipulated in this example are made a bit differently than usual. The image is actually in the top left corner of the SVG viewport. This is because otherwise the image would rotate with the centerpoint in the top left corner of the image. With the image in the top left corner, the rotation works properly and the only thing left to do is translate the image back to the center of the viewport.

4. Known issues

No known issues

5. Build and installation instructions

The example has been made with NetBeans 6.8 and Series 40 6th Edition SDK. The project can be easily opened in NetBeans by selecting Open Project from the File menu and selecting the application.

Before opening the project, make sure a compatible SDK (for example, the Series 40 6th Edition SDK) is installed and added to NetBeans. Building is done by selecting Build main project.

Installing the application on a phone can be done by transfering the JAR file via Nokia Ovi Suite or via Bluetooth on Series 40 devices.

6. Running the example

The application has two views. The main view shows the direction and the currently selected landmark. You can switch the current landmark by pressing left or right.

The second view is for adding landmarks. To open it, press the left softkey which opens the Store Location view. Pressing up or down highlights the text field and pressing the middle softkey opens a text editor where you can type the name of the new landmark. To get back, press the right softkey.

Getting the correct direction requires the user to walk for a while so that GPS is able to determine the correct course.

7. Compatibility

Series 40 6th Edition

Tested on:

  • Nokia 2710 Navigation Edition

Developed with:

  • Netbeans 6.8
  • Series 40 6th Edition SDK

8. Version history

1.0 First Release

9. Related Documenation

  • Location Services in the Java Developer's Library
  • Scalable 2D Vector graphics in the Java Developer's Library
Something went wrong with that request. Please try again.