Scenario - I have designed and developed a powerapp that is intended for offline use, where thousands of images (500Kb each) will be taken and stored on the mobile phone. The end user will go back to office and connect to wifi, then upload those images to sharepoint.
Problem - powerapps heap memory is 30-70Mb. Therefore it is not possible to load all images at once into a collection to send to the server. Even if I break up the images into multiple collections (chunks), they still need to be loaded into memory before they can be uploaded. Since I can't "loop" in powerapps, I am unable to free up memory after an image is uploaded.
Solution -
- Data collection - I have optimised the way I record photos, keeping a lightweight collection with references to the image but do not hold the image itself. Each image is stored locally using SaveData and then cleared from heap memory.
- Data uploading - I use get a list of all the image IDs, then check against Sharepoint which images are already there, then I upload only the images which are not yet uploaded. Even if it crashes mid way, this strategy ensures I can eventually load all images to the server.
However - There must be a better way?