×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:MIDlet cannot power down GPS module with an existing satellite fix (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search
skalogir (Talk | contribs)
(Skalogir -)
skalogir (Talk | contribs)
(Skalogir -)
Line 13: Line 13:
 
|id=KIJ000875
 
|id=KIJ000875
 
|language=<!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 
|language=<!-- Language category code for non-English topics - e.g. Lang-Chinese -->
|review-by=<!-- After re-review: [[User:username]] -->
+
|review-by=skalogir
|review-timestamp=<!-- After re-review: YYYYMMDD -->
+
|review-timestamp=20111117
 
|update-by=<!-- After significant update: [[User:username]]-->
 
|update-by=<!-- After significant update: [[User:username]]-->
 
|update-timestamp=<!-- After significant update: YYYYMMDD -->
 
|update-timestamp=<!-- After significant update: YYYYMMDD -->
Line 72: Line 72:
 
    
 
    
 
A few considerations need to be made regarding the issue mentioned here. Ideally, when setting the location listener, the default values for interval, time out and max age, should be passed to the Location Listener object. For testing purposes it would make sense to replace this line:  
 
A few considerations need to be made regarding the issue mentioned here. Ideally, when setting the location listener, the default values for interval, time out and max age, should be passed to the Location Listener object. For testing purposes it would make sense to replace this line:  
provider.setLocationListener(this, -1, 0, 0);  
+
 
 +
<code>provider.setLocationListener(this, -1, 0, 0);</code>
 +
 
 
with this one:
 
with this one:
provider.setLocationListener(this, -1, -1, -1);  
+
 
 +
<code>provider.setLocationListener(this, -1, -1, -1);</code>
 +
 
 
Another thing, that requires attention is the fact that when trying to stop the location listener from listening to location updates, the following code:   
 
Another thing, that requires attention is the fact that when trying to stop the location listener from listening to location updates, the following code:   
provider.setLocationListener(null, -1, 0, 0);  
+
 
 +
<code>provider.setLocationListener(null, -1, 0, 0); </code>
 +
 
 
should be replaced with:
 
should be replaced with:
provider.setLocationListener(this, 0, 0, 0);  
+
 
 +
<code>provider.setLocationListener(this, 0, 0, 0);</code>
 
   
 
   
 
This is in order for the location listener to be replaced with a new object that does not listen for location updates. Only one location listener can be registered with the given location provider. Registering again a location listener to the given provider, means that the new one replaces the old one.  Setting the interval of the listener to 0, indicates that the application wants to receive only provider status updates and not location updates. In this case, the values of time out and max Age, don’t matter. The LocationListener argument of the setLocationListener method needs to change from null to this in order for the method to refer to a valid LocationListener object, since the midlet implements the LocationListener interface.  
 
This is in order for the location listener to be replaced with a new object that does not listen for location updates. Only one location listener can be registered with the given location provider. Registering again a location listener to the given provider, means that the new one replaces the old one.  Setting the interval of the listener to 0, indicates that the application wants to receive only provider status updates and not location updates. In this case, the values of time out and max Age, don’t matter. The LocationListener argument of the setLocationListener method needs to change from null to this in order for the method to refer to a valid LocationListener object, since the midlet implements the LocationListener interface.  
Line 85: Line 92:
  
 
3rd Edition FP1- Nokia E71
 
3rd Edition FP1- Nokia E71
 +
 
[[File:E71_3rdEditionFP1.jpg]]
 
[[File:E71_3rdEditionFP1.jpg]]
 +
 
3rd Edition FP2 - Nokia 6210 Navigator
 
3rd Edition FP2 - Nokia 6210 Navigator
 +
 
[[File:6210N_3rdEditionFP2.jpg]]
 
[[File:6210N_3rdEditionFP2.jpg]]
 +
 
5th Edition - Nokia C5-03
 
5th Edition - Nokia C5-03
 +
 
[[File:C5-03_5thEdition.jpg]]
 
[[File:C5-03_5thEdition.jpg]]
 +
 
Symbian Anna - Nokia C06-01
 
Symbian Anna - Nokia C06-01
 +
 
[[File:C06-01_Anna.jpg]]
 
[[File:C06-01_Anna.jpg]]
  
From the above results, it is visible that the power consumption before and after stopping the GPS module from within the application, improves greatly in later platforms. In Symbian Anna for example, this is no longer an issue.
+
From the above results, it is visible that the power consumption before and after stopping the GPS module from within the application, improves greatly in later Symbian platforms. In Symbian Anna for example, this is no longer an issue.

Revision as of 14:01, 17 November 2011

Article Metadata
Tested with
Devices(s): Nokia E90 Communicator, Nokia 6110 Navigator
Compatibility
Platform(s): S60 3rd Edition, Feature Pack 1
Symbian
S60 3rd Edition FP1
Article
Created: User:Technical writer 1 (02 Apr 2008)
Reviewed: skalogir (17 Nov 2011)
Last edited: skalogir (17 Nov 2011)

Template:KBKI

Overview

When using Location API's (JSR-179) methods to get a proper provider, it is not possible to stop GPS module location activity if there is a GPS satellite fix, resulting in reduced battery life.

Description

Location API's getInstance(Criteria criteria) method selects the location provider based on the defined criteria, where the value null indicates the least restrictive criteria with default values.

Example usage for acquiring location provider information with JSR-179:

 ..
LocationProvider locProvider;
..
locProvider = LocationProvider.getInstance(null);
locProvider.setLocationListener(this, -1, 0, 0); //setting listener for LocationProvider updates

When acquiring location provider information as defined above, the Location API does not stop GPS module location activity if there is a GPS satellite fix. When the location listener is stopped and the location provider is reset, the actual receiver does not stop and it does not power down (regardless of whether the satellite fix continues to be available or not):

 locProvider.setLocationListener(null, -1, 0, 0); // setting registered listener cancelled   
locProvider.reset(); // resetting LocationProvider by aborting all pending synchronous requests

As a result, battery life is reduced to below 10 hours.

How to reproduce

Download and install Nokia Energy Profiler.

Implement a test MIDlet using this source code.


Procedures:

  1. Launch Nokia Energy Profiler. From Options, choose Start to begin measurement and check the initial battery level in the top right corner.
  2. Leave Nokia Energy Profiler running and exit it by pressing the Menu key.
  3. Launch the test MIDlet. The MIDlet starts searching for a fix. After a fix has been found, press Stop GPS. Leave the MIDlet running and exit it by pressing the Menu key.
  4. Resume to the Nokia Energy Profiler and check the battery level. It is now reduced to below 10 hours.
  5. Repeat step 2.
  6. Resume to the running MIDlet and close it by pressing Exit.
  7. Repeat step 4. The battery level will be slowly resumed. Close the Profiler by pressing Exit. Relaunch the Profiler and start the measurement again to view the improved battery level.


Solution

Exiting the MIDlet results in improved battery level.

Update November 2011

A few considerations need to be made regarding the issue mentioned here. Ideally, when setting the location listener, the default values for interval, time out and max age, should be passed to the Location Listener object. For testing purposes it would make sense to replace this line:

provider.setLocationListener(this, -1, 0, 0);

with this one:

provider.setLocationListener(this, -1, -1, -1);

Another thing, that requires attention is the fact that when trying to stop the location listener from listening to location updates, the following code:

provider.setLocationListener(null, -1, 0, 0);

should be replaced with:

provider.setLocationListener(this, 0, 0, 0);

This is in order for the location listener to be replaced with a new object that does not listen for location updates. Only one location listener can be registered with the given location provider. Registering again a location listener to the given provider, means that the new one replaces the old one. Setting the interval of the listener to 0, indicates that the application wants to receive only provider status updates and not location updates. In this case, the values of time out and max Age, don’t matter. The LocationListener argument of the setLocationListener method needs to change from null to this in order for the method to refer to a valid LocationListener object, since the midlet implements the LocationListener interface.

After performing the above changes, I tested the behavior of the application on various platforms and devices, in order to see how the GPS usage affects the Power Consumptions. Here are my findings:

3rd Edition FP1- Nokia E71

E71 3rdEditionFP1.jpg

3rd Edition FP2 - Nokia 6210 Navigator

6210N 3rdEditionFP2.jpg

5th Edition - Nokia C5-03

C5-03 5thEdition.jpg

Symbian Anna - Nokia C06-01

C06-01 Anna.jpg

From the above results, it is visible that the power consumption before and after stopping the GPS module from within the application, improves greatly in later Symbian platforms. In Symbian Anna for example, this is no longer an issue.

146 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×