Skip to content

Commit 0592dfe

Browse files
authored
Merge pull request #7448 from MicrosoftDocs/u/anuitz/apprestarts
Adds additional documentation on canvas app restarts on Power Apps mobile
2 parents 7d32f3f + 7ada6aa commit 0592dfe

File tree

3 files changed

+79
-12
lines changed

3 files changed

+79
-12
lines changed

powerapps-docs/maker/TOC.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,9 @@
16871687
href: ../mobile/scan-QR-code.md
16881688
- name: Troubleshoot issues for Power Apps mobile
16891689
href: ../mobile/powerapps-mobile-troubleshoot.md
1690+
items:
1691+
- name: Prevent canvas app restarts on Power Apps mobile
1692+
href: ../mobile/power-apps-mobile-canvas-app-restarts.md
16901693
- name: Mobile offline for model-driven apps
16911694
items:
16921695
- name: Set up mobile offline (classic)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Prevent canvas app restarts on Power Apps mobile
3+
description: Learn how to prevent canvas app restarts on Power Apps mobile
4+
author: anuitz
5+
manager: tapanm-MSFT
6+
ms.component: pa-user
7+
ms.topic: conceptual
8+
ms.date: 01/05/2023
9+
ms.subservice: mobile
10+
ms.author: sericks
11+
ms.custom: ""
12+
ms.reviewer: ""
13+
ms.assetid:
14+
search.audienceType:
15+
- enduser
16+
search.app:
17+
- PowerApps
18+
---
19+
20+
# Prevent canvas app restarts on Power Apps mobile
21+
22+
When you run a canvas app on Power Apps mobile, it can be restarted for the following reasons:
23+
24+
- The app is using too much total memory.
25+
- The app is using too much memory or processing at one time.
26+
- The app is moved to background – either when your specific app uses a native control (like **Add Picture** or **Barcode Scanner**) or the Power Apps mobile app is put in the background by the user.
27+
28+
This memory and processing limitations, which is especially strict when the Power Apps mobile app runs the background, is imposed by the operating system (Android or iOS). If the app uses more resources than are available on your device, the app will reset. This is similar to when you visit a large complex webpage, the web browser suspends the page if it is consuming too much power.
29+
30+
On Android devices, this app restart can look like a crash because the app is completely closed and the user is taken to the home screen of the device.
31+
32+
Use this article to learn how to prevent canvas app restarts on Power Apps mobile.
33+
34+
## Prevention tips for end users
35+
36+
While the biggest improvements are usually made by app makers, here are some tips that end users can use to decrease the occurrence of app restarts:
37+
38+
- In the Power Apps mobile app, on the uer profile page, select **Clear cache** to remove saved data. Note that this should only be done when the end user has data as clearing the cache will remove any **SaveData** or app caches.
39+
- On Android devices, set the battery to unrestricted for the Power Apps mobile app.
40+
- Close any running apps, other than the Power Apps mobile app, and remove any unneeded data from the device such as unused apps or images.
41+
- While it is cumbersome, consider using the app slower – pause a little bit between screen navigations or after taking pictures or saving or loading data.
42+
43+
## Prevention tips for app makers
44+
45+
The greatest memory improvements to decrease app restarts can be made by app makers. When creating an app, remember to optimize the app to run on the lowest-specification device that your end users will use and follow best practices around resource usage.
46+
47+
> [!NOTE]
48+
> Since app restarts are caused by the operating system restricting the amount of memory and processing an app can do, it might take a combination of the mitigations suggested below to minimize app restarts. The more memory and processing that can be reduced, both in total and at one time, the less likely an app restart will be.
49+
50+
> [!TIP]
51+
> You can [connect a mobile app session to Monitor](../maker/monitor-canvasapps.md#for-apps-running-on-power-apps-mobile-preview) to see where your app is doing heavy processing or memory-intensive operations. Monitor is a tool that offers makers a deep view of what an app does and how it does it by logging all key activities that occur in the app as it runs.
52+
53+
| Problem | Root Cause | Mitigation |
54+
|---------|---------|---------|
55+
| App restarts when loading a specific screen. | If a specific screen is running too many formulas at one time, the app can have too much processing and be restarted by the operating system. | Limit the number of controls on a screen and the number of formulas being run when the screen is loaded, which might require splitting up screens. <br><br> Avoid control dependency between screens. <br><br> Prevent the user from taking action during high-processing moments. For example, when a large gallery with multiple filters and lookups is loading. <br><br> Consider using named formulas. <br><br> Consider using the **Delayed Load** app setting. |
56+
| App restarts after multiple screen navigations. | There are memory leaks happening on the screens, resulting in memory usage building up as the user navigates around the app. | Turn on the **Keep recently visited screens in memory** app setting. While this increases total memory usage in the short term as the screen is preserved in memory, across multiple screen navigations, it will prevent memory leaks. |
57+
| App restarts when doing **SaveData**/**LoadData** or using data connections. | **SaveData** and data connections both increase the total memory being used by the app. **SaveData** is also a processing-heavy operation. Bringing in large amounts of data into the app and saving that data for offline usage (especially media content and files) can cause the app to go above its allotted memory, causing the operating system to restart the app. | Optimize the amount of data brought into the app via data connections and saved via **SaveData**. <br><br> Reduce the number of **SaveData** calls where possible. <br><br> Turning on the **Explicit column selection** app setting and turning off the **Record scope one-to-many and many-to-many relationships** app setting can also help reduce the data being brought into the app. |
58+
| App restarts when using the camera control. | The camera control saves the captured image to memory. This can increase the memory usage of the app, especially if the captured image is saved into variables or **SaveData** using the **OnStream** property. | Do not save any images beyond the most recently captured one. <br><br> Use **Photo** instead of **Stream** to only capture images when the user taps on the camera. <br><br> If you need to use **Stream**, set the **StreamRate** property as high as possible to reduce the number of updates. |
59+
| App restarts when using the **Add Picture** control. | The **Add Picture** control saves the selected media content into memory. Due to the size of media content, this can result in significant memory pressure. | Consider changing where the media content is captured. <br><br> Consider turning off the **UseMobileCamera** property so users can only select media from gallery/photo library. <br><br> Consider using the attachment control (as part of a form) to only select files instead of capturing them using the camera. <br><br> Consider switching to the camera control. |
60+
| App restarts when using native controls like **Add Picture**, **Barcode Scanner/Reader**, **View in MR**, **Measuring camera**, and others. | Native controls can put the app in the background where the operating system has stricter limitations on memory before restarting the app. | Make sure all memory and processing intensive operations are completed before using these controls. For example, disable the **Add Picture** control until any **SaveData** operations are completed. <br><br> Consider switching to a different control like **Camera** instead of **Add Picture**. |
61+
| App restarts happen for a subset of devices. | Devices have different amounts of memory and processing available. As an example, older devices are more prone to app restarts due to their lower available processing. <br><br> Having other apps running can also reduce the amount of processing available. Similarly, other apps installed and lots of photos/media saved to the device can take up memory, reducing what is available for the app. | Refer your users to the tips listed above in our [Prevention tips for end users](#prevention-tips-for-end-users) section. <br><br> Consider investing in devices that meet the performance needs of your app. |
62+
| App restarts continue to happen. | Memory usage is impacted by how the canvas app is authored. Make sure your app follows best practices can help ensure performance, reduce memory usage, and processing. | Optimize your app following the [best practices](#best-practices-for-building-performant-apps) below. |
63+
64+
## Best practices for building performant apps
65+
66+
- [Build large and complex apps](../maker/canvas-apps/working-with-large-apps.md)
67+
- [Common canvas app performance issues and resolutions](../maker/canvas-apps/common-performance-issue-resolutions.md)
68+
- [Tips and best practices to improve performance of canvas apps](../maker/canvas-apps/performance-tips.md)
69+
- [Power Apps canvas app coding standards and guidelines](https://powerapps.microsoft.com/blog/powerapps-canvas-app-coding-standards-and-guidelines/)
70+
- [Power Apps canvas app coding standards and guidelines whitepaper](https://pahandsonlab.blob.core.windows.net/documents/PowerApps%20canvas%20app%20coding%20standards%20and%20guidelines.pdf) (Be sure to review the section titled, **Optimizing for performance**.)

powerapps-docs/mobile/powerapps-mobile-troubleshoot.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ manager: tapanm-MSFT
66

77
ms.component: pa-user
88
ms.topic: conceptual
9-
ms.date: 11/12/2021
9+
ms.date: 01/03/2023
1010
ms.subservice: mobile
1111
ms.author: sericks
1212
ms.custom: ""
@@ -53,7 +53,7 @@ Microsoft authentication apps are Authenticator and Company Portal. Your company
5353
> [!NOTE]
5454
> Power Apps requires a valid license to sign in. For more information, see [Licensing overview](/power-platform/admin/pricing-billing-skus).
5555
56-
Sometimes, updating and manually opening the authentication app on your device before signing in to Power Apps mobile can fix the problem. If this doesn't fix the issue, then follow the next steps depending on your device manufacturer and authentication app.
56+
Sometimes, updating and manually opening the authentication app on your device before signing in to Power Apps mobile can fix the problem. If this doesn't fix the issue, then follow the next steps depending on your device manufacturer and authentication app.
5757

5858
### Huawei or Honor device
5959

@@ -82,7 +82,7 @@ If the issue is still not fixed, then try these steps:
8282
5. Install [Power Apps mobile](../mobile/run-powerapps-on-mobile.md).
8383
6. Open Power Apps mobile and sign in.
8484

85-
If you still can't sign in, then email us at [email protected] and include your device make and model, session ID, and provide the exact error message that you get.
85+
If you still can't sign in, then email us at [email protected] and include your device make and model, session ID, and provide the exact error message that you get.
8686

8787
## App list is empty
8888

@@ -102,17 +102,11 @@ To resolve connection related issues, ensure you remain connected to the interne
102102

103103
## App resets when running it on Power Apps mobile
104104

105-
When you run a canvas or model-driven app on Power Apps mobile it can reset if the app is using too many resources. If the app uses more resources than are available on your device, the app will reset. This is similar to when you visit a large complex webpage, and the web browser suspends the page because it is consuming too much power.
105+
When you run a canvas or model-driven app on Power Apps mobile, it can reset if the app is using too many resources. If the app uses more resources than are available on your device, the app will reset. This is similar to when you visit a large, complex webpage and the web browser suspends the page because it is consuming too much power.
106106

107-
Power Apps mobile is designed to run on a wide range of devices, including low-end devices with limited resources. When you create a canvas or model-driven app, remember to optimize the app to run on the lowest-specification device that your end-users will use.
107+
On Android devices, this app restart can look like a crash because the app is completely closed and the user is taken to the home screen of the device.
108108

109-
If you experience a reset, contact your app developer, and point them to this topic.
110-
111-
For more information for developers, see:
112-
113-
- Blog post: [PowerApps coding standards and guidelines](https://powerapps.microsoft.com/blog/powerapps-canvas-app-coding-standards-and-guidelines/)
114-
- Whitepaper: [PowerApps canvas app coding
115-
standards and guidelines](https://pahandsonlab.blob.core.windows.net/documents/PowerApps%20canvas%20app%20coding%20standards%20and%20guidelines.pdf) (Note, review the section titled, **Optimizing for performance**).
109+
If you experience a reset while using a canvas app, contact your app developer, and see [Prevent canvas app restarts](../mobile/power-apps-mobile-canvas-app-restarts.md).
116110

117111
## Unable to download SharePoint attachment in the mobile app
118112

0 commit comments

Comments
 (0)