I’m making an Android test app (ID 169218) to get the compass heading of the device when a button is pressed.
The home screen has a paragraph component bound to the heading page variable of type number bound to the formula sensorVars.compass.latestValue.heading:
There’s also a Get heading button with a logic flow that calls Get single compass value and Set page variableheading to the formula sensorVars.compass.latestValue.heading:
When I test the app with the AppGyver app and tap Get heading, the paragraph component remains blank and no heading appears. The debugger shows the compass heading value in both the sensor variables and in the heading page variable.
What am I doing wrong? Is this a bug?
I have a Pixel 4 XL with Android 11 and version 2.4.3 of the AppGyver app. I’m in the Beta program but the test app doesn’t have the Beta option turned on.
I don’t get compass responses either.
When debbuging, the compass sensor variable “active” doesn’t switch to true when clicking the Button to enable the compass, which seems odd.
The output of sensorVars.compass.latestValue.heading is either undefined or [Object object]
(used the concatenation like @Mevi"test: " + sensorVars.compass.latestValue.heading
I think the problem You all are running into is that sensorVars.compass.latestValue.heading is an Object. You need to add the .degree field to get the actual degree value.
Thanks - now the “object” string in the response makes sense - however, I think the documentation is misleading, it says The direction in which the device is facing, in degrees from true north.