Alloy Location Error

I’m having an issue with the watchface I made using Alloy before I received my Time 2. Now I have it I’m finding it can’t get the location.

This works fine in the emulator with no problems, my other watchface written in C works fine getting the weather on the watch itself.

The error I get is:

[VERBOSE] xsHost.c:155: Requesting Location
[VERBOSE] xsRun.c:409: Exception Error: single instance only

[VERBOSE] xsHost.c:155: Event ("minutechange") exception: Error: single instance only
[VERBOSE] xsHost.c:155: Error: single instance only
 at Location ()
 at requestLocation ()
 at minuteTick ()
 a
[VERBOSE] xsHost.c:155: do ()
 at ()

The code in question is:

function requestLocation() {
    if (settings.temp) {
      const location = new Location({
          onSample() {
              const sample = this.sample();
              console.log("Got location: " + sample.latitude + ", " + sample.longitude);
              this.close();
              fetchWeather(sample.latitude, sample.longitude);
          }
      });
    }
}

The entire code is here: GitHub - beatles1/PebblePurple · GitHub

I can’t find any info at all on this error, my code is the same as the moddable example. Any ideas?

1 Like

hey edb, thanks for reporting this, i’ll check it out and will get back to you!

3 Likes

Did you ever get a chance to check this out?

I’ve just had another look in CloudPebble, rebuilt this and the same happens. Works fine in Emulator but errors on the watch.

I’m stumped, especially as it doesn’t seem anyone else has hit this issue!

I just encountered this exact same error, with weather code similar to edb’s PebblePurple.

1 Like