DataField and GPS permission?

Former Member
Former Member
Dear experts,

I'm a newbie trying to make a DataField displaying some GPS information.
But I get some problem with permissions.

If I make a SimpleDataField like this:

using Toybox.WatchUi as Ui;
using Toybox.Position as Position;

class MGRSdataFieldView extends Ui.SimpleDataField {

function initialize() {
label = "MGRS";
}

function compute(info) {
if( info.currentLocation != null )
{
return info.currentLocation.toGeoString(Position.GEO_MGRS);
} else {
return "No Signal";
}
}
}


the Eclipse simulator will display: "MGRS No Signal" as expected.
If I give the simulator the command: Simulation -> Fit Data -> Simulate Data
I get the console error message: "Permission Required"

I tried to modify the project property in Eclipse by ticking for "Positioning" in the "Permissions" box but then I get the error message:
BUILD: ERROR: The following permission is invalid for a Data Field: Positioning
ERROR: Bad manifest file

What is wrong. How can I get permissions to use info.currentLocation in DataField ?

The problem is present for both SimpleDataField and DataField classes.

Thanks for any help!
  • As the error says. U are not allowed to use the GPS In a datafield.
    If u want to use , write a full blown app.
  • You're trying to access the Position module.

    (Position.GEO_MGRS). Look and see what that constant is, and try that in place of "Position.GEO_MGRS".

    (GEO_MGRS = 3)

    I tried your code with 3 in place of Position.GEO_MGRS and the "using" for Position commented out, and it runs on a vivoactive, with no new permissions needed. I don't really know the MGRS format, and walking for a block, the 7 digits remain as zeros...and the two letters are WF. Playing back a .fit for the same area in the simulator shows VM and numbers that are non-zero and do change. Could be a bug in the formatting routine itself.
  • Former Member
    Former Member over 10 years ago
    You're trying to access the Position module.

    (Position.GEO_MGRS). Look and see what that constant is, and try that in place of "Position.GEO_MGRS".

    (GEO_MGRS = 3)

    I tried your code with 3 in place of Position.GEO_MGRS and the "using" for Position commented out, and it runs on a vivoactive, with no new permissions needed. I don't really know the MGRS format, and walking for a block, the 7 digits remain as zeros...and the two letters are WF. Playing back a .fit for the same area in the simulator shows VM and numbers that are non-zero and do change. Could be a bug in the formatting routine itself.


    Thank you very much for your help. I tried your workaround and it works very nicely. Also on my Fenix3 when I test it in the field. The numbers are non-zero and correct on my watch.

    Why the digits are zero on a real vivoactive is strange. But I guess the problem is related to the length of the string. As you point out you see 7 trailing digits in the vivoactive simulator. In the Fenix3 simulator you will see 10 digits. It should be an even number. The first half of the trailing digits defines the easting position, while the remaining digits define the northing position. (5 digits for each easting/northing defines the number of meters in each direction from the start of the actual 100x100km UTM square.)

    Is there a place for submitting bug reports or should we expect the Garmin team to detect every issue brought up in this forum?

    Why constants like Position.GEO_MGRS should not be available for data fields must be a bug. Position related data is a very natural topic for data fields.

    The next SDK should also include a Position.GEO_UTM format.
    UTM is probably the most popular format for topo maps. Very complex conversion from other formats, implemented by apps developers, should be avoided for reasons like waisted precious memory and reliability of apps. The UTM format is already implemented and carefully tested by Garmin.