<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://forums.garmin.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Error: Out Of Memory Error when installing the beta version of my watch face</title><link>https://forums.garmin.com/developer/connect-iq/f/discussion/388390/error-out-of-memory-error-when-installing-the-beta-version-of-my-watch-face</link><description>Hi community, I&amp;#39;m testing my Watch Face from a Beta version installed from IQ Connect. After the installation, I can see that for some reason the installation date is not being store properly in the Application . Storage. This is my code: In the simulator</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Oct 2024 18:13:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://forums.garmin.com/developer/connect-iq/f/discussion/388390/error-out-of-memory-error-when-installing-the-beta-version-of-my-watch-face" /><item><title>RE: Error: Out Of Memory Error when installing the beta version of my watch face</title><link>https://forums.garmin.com/thread/1847806?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 18:13:48 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:ab834f27-b123-4728-8b1b-86a60833a1d1</guid><dc:creator>Juan Dom&amp;#237;nguez</dc:creator><description>&lt;p&gt;&lt;a href="https://forums.garmin.com/members/jim_5f00_m_5f00_58"&gt;jim_m_58&lt;/a&gt;, That was very helpfull, I ended up doing the following:&lt;br /&gt;&lt;br /&gt;1- I scoped all my resources(&lt;strong&gt;font&lt;/strong&gt;, &lt;strong&gt;string&lt;/strong&gt;, &lt;strong&gt;bitmap&lt;/strong&gt; and the &lt;strong&gt;layout&lt;/strong&gt;) as &lt;strong&gt;&amp;quot;foreground&amp;quot;&amp;nbsp;&lt;/strong&gt;since I ain&amp;#39;t using it in my base class and thus save memory.&lt;/p&gt;
&lt;p&gt;2- I decorated also with&amp;nbsp;&lt;strong&gt;(:background)&lt;/strong&gt;&amp;nbsp;all the global and external variables&amp;nbsp;that I&amp;#39;m using in my base class, like for instance the&amp;nbsp;&lt;strong&gt;Helpers&lt;/strong&gt; class, since I&amp;#39;m using&amp;nbsp;&lt;em&gt;Helpers.INSTALLED_ON_DATE_STORAGE_KEY.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;So, I&amp;#39;ve published a new beta version and this time finally worked. I&amp;#39;ll monitor it a bit more to ensure all is good.&lt;br /&gt;&lt;br /&gt;As always, thank you my friend for the great help.&lt;br /&gt;&lt;br /&gt;/Juan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error: Out Of Memory Error when installing the beta version of my watch face</title><link>https://forums.garmin.com/thread/1847772?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 17:23:34 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:cff08844-71ce-4527-aba0-710aa59586bf</guid><dc:creator>jim_m_58</dc:creator><description>&lt;p&gt;You need to scope the resources you are using is my guess.&amp;nbsp; See&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.garmin.com/connect-iq/core-topics/resources/#resources"&gt;https://developer.garmin.com/connect-iq/core-topics/resources/#resources&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Resource Scopes&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s how you can translate the PC values and see where it&amp;#39;s happening in your code:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://forums.garmin.com/developer/connect-iq/f/discussion/231129/so-you-have-a-ciq_log-file-but-all-you-see-is-pc-without-a-friendly-stack-trace---what-to-do"&gt;https://forums.garmin.com/developer/connect-iq/f/discussion/231129/so-you-have-a-ciq_log-file-but-all-you-see-is-pc-without-a-friendly-stack-trace---what-to-do&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error: Out Of Memory Error when installing the beta version of my watch face</title><link>https://forums.garmin.com/thread/1847769?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 17:15:37 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:b1ec2998-ff45-4869-95b7-ea135df0230d</guid><dc:creator>Juan Dom&amp;#237;nguez</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://forums.garmin.com/members/jim_5f00_m_5f00_58"&gt;jim_m_58&lt;/a&gt;,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve tried the approach you suggested, and now my code looks like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="typescript"&gt;import Toybox.Application;
import Toybox.Lang;
import Toybox.WatchUi;
import Toybox.Time.Gregorian;

(:background)
class MyWatchFaceApp extends Application.AppBase {

    function initialize() {
        AppBase.initialize();
    }

    // onStart() is called on application start up
    function onStart(state as Dictionary?) as Void {
    }

    // onStop() is called when your application is exiting
    function onStop(state as Dictionary?) as Void {
    }

    function onAppInstall() as Void {
        storeInstallationDate();
    }

    function onAppUpdate() as Void {
        storeInstallationDate();
    }

    // Return the initial view of your application here
    function getInitialView() as [Views] or [Views, InputDelegates] {
        if(!Helpers.isAmoled() and Toybox.WatchUi.WatchFace has :onPartialUpdate) {
            return [ new MyWatchFaceView() as Views, new MyWatchFaceDelegate() as InputDelegates ];
        }

        return [ new MyWatchFaceBIPView() ];
    }

    // New app settings have been received so trigger a UI update
    function onSettingsChanged() as Void {
        WatchUi.requestUpdate();
    }

    function getSettingsView() {
        var settingsMenu=new MyWatchFaceSettingsMenu();
        return [settingsMenu as Views, new MyWatchFaceSettingsMenuDelegate(settingsMenu) as InputDelegates];
    }

    hidden function storeInstallationDate() as Void {
        var epochInstalledOn = Application.Storage.getValue(Helpers.INSTALLED_ON_DATE_STORAGE_KEY);
        if (epochInstalledOn == null) {
            var epoch = Time.now().value();
            Application.Storage.setValue(Helpers.INSTALLED_ON_DATE_STORAGE_KEY, epoch);
        }
    }
}

function getApp() as MyWatchFaceApp {
    return Application.getApp() as MyWatchFaceApp;
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I tried, and uploaded and published a new beta version, however after installing it I got the following error in the logs:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;---
Error: Illegal Access (Out of Bounds)
Details: &amp;#39;Failed invoking &amp;lt;symbol&amp;gt;&amp;#39;
Time: 2024-10-16T16:59:03Z
Part-Number: 006-B3291-00
Firmware-Version: &amp;#39;27.00&amp;#39;
Language-Code: spa
ConnectIQ-Version: 5.0.1
Store-Id: 3ff25bd7-09bf-412d-ae93-2bd2e23b1ce4
Store-Version: 4
Filename: EAGG5047
Appname: MyWatchFace
Stack: 
  - pc: 0x1000004c
  - pc: 0x10000021&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now it&amp;#39;s a different error, not &amp;quot;Out Of Memory&amp;quot; anymore, which means that the&amp;nbsp;(:background) did work.&lt;br /&gt;&lt;br /&gt;Can this new error&amp;nbsp;reside in my&amp;nbsp;storeInstallationDate function?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error: Out Of Memory Error when installing the beta version of my watch face</title><link>https://forums.garmin.com/thread/1847764?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 17:07:45 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:0174f95c-2b81-4f4e-9af7-32e50a67c8c0</guid><dc:creator>Juan Dom&amp;#237;nguez</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://forums.garmin.com/members/237419224e814eb7be09ba868d70607f"&gt;flocsy🤠&lt;/a&gt;,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;To answer your question, this is what I have in my memory usage:&lt;br /&gt;&lt;br /&gt;&lt;img src="https://forums.garmin.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/12/pastedimage1729098392749v1.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;I think those numbers are ok for my understanding.&lt;br /&gt;&lt;br /&gt;Do you see something wrong there?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error: Out Of Memory Error when installing the beta version of my watch face</title><link>https://forums.garmin.com/thread/1847557?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 09:03:52 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:23d6b6b2-136b-4c60-8ce6-1c7f2635bac8</guid><dc:creator>jim_m_58</dc:creator><description>&lt;p&gt;To use onAppInstall, onAppUpdate, you need to have the background permission set, but that also means you want to annotate things for the background, or it will try to load your entire app when the background runs.&lt;/p&gt;
&lt;p&gt;In the code you posted, before the class definition for AppBase (right before line 1), try adding&amp;nbsp;&lt;/p&gt;
&lt;p&gt;(:background)&lt;/p&gt;
&lt;p&gt;That way only your AppBase gets loaded when the background runs&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error: Out Of Memory Error when installing the beta version of my watch face</title><link>https://forums.garmin.com/thread/1847556?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 08:58:13 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:a4c2e738-0c0f-4ef1-93af-1ae1e6a9f525</guid><dc:creator>Antonynguyen</dc:creator><description>&lt;p&gt;Is there any &lt;a href="https://myinstants39.com/sound-effects/"&gt;sound effect&lt;/a&gt; coming out?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error: Out Of Memory Error when installing the beta version of my watch face</title><link>https://forums.garmin.com/thread/1847441?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 00:16:24 GMT</pubDate><guid isPermaLink="false">a9571b57-dd57-479e-8763-8f8a603e40aa:4d476c07-e010-45d0-9ead-4150343105d8</guid><dc:creator>flocsy&amp;#129312;</dc:creator><description>&lt;p&gt;how does the memory usage (and peak memory) look in the sim on the same device?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>