Under Review
over 2 years ago

SDK 4.2.0 Beta 1 won't compile AppBase.getProperty

Given

  return Application.getApp().getProperty(s);
The compiler reports
  ERROR: fr235: test.mc: '$.Toybox.Application.AppBase.getProperty' is deprecated.
But fr235 doesn't support Application.Properties.getValue, so I *have* to use getProperty when compiling for fr235.
  • Thanks a lot. I have quite a new one. "On Device Watch Face and Data Field Settings" should work for me.

  • is there a way to change any of these Property, StorageValue, etc. directly from the watch?

    Well, you can call Storage.setValue() and Properties.setValue() from any device that supports those APIs. But the issue is how to present a UI for doing that. Prior to sdk-3.2.0, you couldn't do that with watch faces, or data fields, for example. But for devices that support 3.2.0 or later, you can add a getSettingsView() method to your main app class. See "On Device Watch Face and Data Field Settings" at the bottom of this page.

  • Thank you. Somehow this is a good article https://developer.garmin.com/connect-iq/core-topics/persisting-data/ which I only found after reading your answer :) Maybe you know, is there a way to change any of these Property, StorageValue, etc. directly from the watch? or it is only possible from the phone?

  • What is the replacement for Toybox.Application.AppBase.getProperty

    If you're targeting an older device (devices that don't support sdk-2.4 or later) there isn't one.

    If you're targeting a newer device, then either Application.Properties.getValue, or Storage.getValue, depending on exactly what you're doing. But others have claimed here that neither is an exact replacement, and getProperty does some things better...

  • What is the replacement for Toybox.Application.AppBase.getProperty? If it is deprecated, what should I use instead of it?