I already have a guess for the answer to that question but I want to make sure. If I make an application that enables location events and I keep it running all the time, is the GPS module going to consume lots of energy even if the signal is very weak (indoors), or does it have a built-in mechanism that decreases the power draw in such cases?
If the answer is yes then I have another problem; I made an application that disables location events when the accuracy is less than or equal to 2 to make it energy-effienct. I added a counter in the callback method that receives the position object just to see how many position objects it receives over time. However, The application often fails to detect a change in signal when I go indoors. I am currently running the app and it says the accuracy is 4 even though the callback method is not being invoked (the counter stopped), indicating an absence of a GPS signal. Did I do something wrong? the watch I am using is Vivoactive 4.
This is my code (P.S. I removed the if condition just to isolate the accuracy problem):
function initialize() { View.initialize(); enableLocation(); } function onPosition(info) { counter = counter + 1; posInfo = info; accuracy = posInfo.accuracy; stats = System.getSystemStats(); percentage = stats.battery.toNumber(); //if GPS enabled check quality. If disabled disable location data. //If accuracy is good record data. If accuracy disable gps. // if (accuracy == Position.QUALITY_GOOD || accuracy == Position.QUALITY_USABLE){ // location = posInfo.position.toDegrees(); // } else { // disableLocation(); // } WatchUi.requestUpdate(); } function enableLocation() { gpsEnabled = true; if (Position has :hasConfigurationSupport) { if ((Position has :CONFIGURATION_GPS_GLONASS_GALILEO_BEIDOU_L1_L5) && (Position.hasConfigurationSupport(Position.CONFIGURATION_GPS_GLONASS_GALILEO_BEIDOU_L1_L5))) { options[:configuration] = Position.CONFIGURATION_GPS_GLONASS_GALILEO_BEIDOU_L1_L5; } else if ((Position has :CONFIGURATION_GPS_GLONASS_GALILEO_BEIDOU_L1) && (Position.hasConfigurationSupport(Position.CONFIGURATION_GPS_GLONASS_GALILEO_BEIDOU_L1))) { options[:configuration] = Position.CONFIGURATION_GPS_GLONASS_GALILEO_BEIDOU_L1; } else if ((Position has :CONFIGURATION_GPS) && (Position.hasConfigurationSupport(Position.CONFIGURATION_GPS))) { options[:configuration] = Position.CONFIGURATION_GPS; } } else if (Position has :CONSTELLATION_GLONASS) { // this can fail with InvalidValueException if combination is not supported by device options[:constellations] = [ Position.CONSTELLATION_GPS, Position.CONSTELLATION_GLONASS ]; } options[:acquisitionType] = Position.LOCATION_CONTINUOUS; //Starts the reciever, sends recieved info to onPosition Position.enableLocationEvents(options, method(:onPosition)); // System.println("enableLocationEvents is called"); }