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.
Java ME basics
2. Important files and classes
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.
Series 40 6th Edition
- Nokia 2710 Navigation Edition
- Netbeans 6.8
Series 40 6th Edition SDK
8. Version history
1.0 First Release