OK. Here is my app scenario: I have created an app that includes several images as resources, but which does not directly use the images in an image control on a screen. The images are called and displayed in an image control only when the result of a formula triggers them in the App. The whole things works great when I am building it and previewing it. However, when I publish the app and run it, none of the images show up. I have discovered that if I do put the image directly onto a screen somewhere in the app, then those images will display when called by the formula. As far as I can tell, what is happening is that the App is not loading the image resources because it does not look like they are used in the app. I guess I could trick the app by loading all of the images on a screen and making them not visible, but I am hoping there is some other way to force the App to load the image resources without having to build them explicitly onto a screen. Any ideas?
Could you please clarify what you mean by 'includes several images as resources'? Are the images added to the media of the app, if not, where are they stored?
What is the formula you use in the image control?
@Meneghino, yes, the images were uploaded into the "Media: Images" section of the online PowerApp studio. They are then called in the app through the following process:
1) There is an Image Control on a screen whose image property is set to the variable "image". This variable is initially blank, as I do not want an image on the screen when it loads.
2) There is a button on the screen that randomly selects one of the images. I accomplish this by having a collection created ("Notes") with the names of the image files as its values, then using the Rand function (using a variable "RndSelector") to assist in selecting a random record from that collection. The varible "image" is then set to the selected image name, along with the additional text needed to refer to the media image:
This works great when building the app and when previewing the app. However, when I open the published version, either on a desktop machine or through the mobile app, no images appear.
HOWEVER, if I "preload" the images directly into an image control, say, on another screen of my app, then those images do display correctly as a result of my formula in the variable-controlled image control. This is telling me that PowerApps DOES NOT load an image resource from the media unless it is called directly in the App. I was only wondering if there was a way to avoid creating the dummy image controls and have the App load all media resources, regardless of whether they are directly called by a control in the App.
I hope this helps clarify. My issue is not with my formula, but rather with how PowerApps loads media resources.
Apologies running late so quick reply. You should refer to the images as a variable, no need to do the concatenate, I think.
in other words, if the image name is Foo or Bar then the collection should contain Foo and not "Foo" as text. Then you do not need the concatenate. Gotta run...
I am wondering if anyone found a solution to this.
I can confirm this behaviour still exists (and it is as much a pain as it is unnecessary).
Images that are uploaded into the "storaged media" section but are not fixed referenced to in the app (f.i. by having an image control directly connect to the image file) are working perfectly fine on desktop but seem to be not part of the mobile app at all.
(In a way this would make sense: an automatic check by powerapps and only delivering those media files to the mobile app which it thinks are necessary. All files which are not directly referenced to at start of the app are considered "garbage" and will not be available in the mobile app at runtime. However please make such memory "optimizations" customable and put the decision in the hand of the programmer).
Adding those files to a "collection" does not help to solve the issue, they remain unavailable.
As the threadstarter described: only creating a (hidden) fixed image per image file makes them available to the app. If you have 10+ images which could change and have to be updated this becomes a nuisance.
Is there anyway to "force" the inclusion of (all) media files to the mobile app?
Thanks in advance for any help.
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
Check out the winners of the recent 'Can You Solve These?' community challenge!
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Featuring samples like Return to the Workplace and Emergency Response Applications
Features releasing from October 2020 through March 2021