Acknowledged

AppBase.onBackgroundData requires Application.PersistableType, whereas Background.getBackgroundData and Background.exit use Application.PropertyValueType

As per the subject, there is a type discrepancy in the API.

Now, Application.PersistableType is actually defined to be the same as Application.PropertyValueType, which is fine, but Background.getBackgroundData and Background.exit should still be listed as using Application.PersistableType for consistency.

In addition, it would be REALLY good if Application.PersistableType (and/or Application.PropertyValueType) could be extended to include Graphics.BitmapReference and Graphics.FontReference so that these objects can be passed to the foreground through Background.exit. I can't see any reason why this shouldn't be done. It otherwise requires using Storage.set/getValue, which is a heavy-handed approach for sending a tiny object.

  • > but you can pass the BitmapReference from the background to the foreground through Storage.setValue(), and it comes through as a BitmapReference, and it works just fine. So it should be possible with Background.exit().

    I think what's happening is that when you call Storage.setValue(), the bitmap reference is implicitly derefenced, and the bitmap itself is saved to storage. The foreground is loading the entire image from storage, not just a reference.

    It's doubtful that the reference itself is saved to storage, as that reference would become invalid as soon as the bitmap was released from the graphics pool.

    I validated this in the simulator (for fr955, which is CIQ 5 with graphics pool), in a watchface app. I have code which retrieves an 3-colour 550 x 550 PNG image in the background, and uses Storage.setValue() on the resulting BitmapReference. The code in the foreground gets the image from storage and renders it.

    Sure enough, when I look in the simulator's "device filesystem" (which mirrors the real filesystem on the device), the app storage has a file that's 310 KB (if I delete the file, it only reappears when I trigger the temporal event). This is consistent with a 550 x 550 8-bit bitmap.

  • Hi flocsy, I thought about that too, but you can pass the BitmapReference from the background to the foreground through Storage.setValue(), and it comes through as a BitmapReference, and it works just fine. So it should be possible with Background.exit().

  • IMHO as the name suggests they are references, that probably mean they reference some object in the memory (maybe graphic pool) of the process/app that runs it. So it is possible that it is referencing some memory in the background process, that the foreground process won't be able to access.