-
Notifications
You must be signed in to change notification settings - Fork 530
[Doc Improvement][Best practices for mobile tabs][4347376] #12500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
9a6b5e2
First draft
v-kushals be69302
Merge branch 'main' into tab-best-practices
v-kushals ce6eea9
Second draft
v-kushals 9aa2ff2
Build error fix
v-kushals d015bde
Merge branch 'main' into tab-best-practices
v-kushals 224e566
Refine content
v-kushals 0d3afd5
Alignment issues
v-kushals 3118133
Merge branch 'main' into tab-best-practices
v-kushals f8c2ef4
Update msteams-platform/TOC.yml
v-kushals 3bfa986
Minor edits
v-kushals 69ae1b2
Merge branch 'main' into tab-best-practices
v-kushals 93c2580
Merge branch 'main' into tab-best-practices
v-kushals dca3a5d
Review changes
v-kushals d9e9a50
Update create-personal-tab.md
v-kushals 94ac456
Merge branch 'main' into tab-best-practices
v-kushals cb45994
Update teams-faq.md
v-kushals b29ca14
upDATE
v-kushals beab3f3
Merge branch 'main' into tab-best-practices
v-kushals 1ff670e
Review changes
v-kushals 0d49561
Review suggestion
v-kushals 972dc6a
Update teams-faq.md
v-kushals 7fc3d94
Update teams-faq.md
v-kushals d0d1c7c
upDATE
v-kushals 73b3dd5
Update teams-mobile-best-practices.md
v-kushals File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
title: Teams Mobile Apps Best Practices | ||
author: surbhigupta | ||
ms.author: surbhigupta | ||
description: Learn how to optimize your tab app performance on Teams mobile with best practices such as using service workers and performance audits. | ||
ms.localizationpriority: high | ||
ms.topic: conceptual | ||
ms.date: 03/27/2025 | ||
--- | ||
|
||
# Best practices for Teams mobile apps | ||
v-kushals marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Mobile devices have limited processing power, network connectivity, and battery compared to desktops and laptops. If you want to increase the adoption of your Teams tab app on mobile devices, you must ensure a fast and responsive web experience on the Teams Android and iOS clients. This article outlines the best practices to optimize your Teams tab's webpages for the Teams mobile client. | ||
|
||
## Use service workers to cache static assets | ||
|
||
* Cache static assets such as HTML, CSS, JavaScript, and images to reduce network dependency. | ||
* Use the stale-while-revalidate strategy to serve cached content quickly while fetching updated data in the background. You can also use this strategy to cache API responses that don't change frequently, such as configuration data. | ||
* Avoid caching large assets to prevent unnecessary storage consumption on mobile devices. | ||
|
||
### Sample app | ||
|
||
Check out this [sample app](https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/tab-support-offline/nodejs) that makes use of a service worker to cache data and provide offline functionality. | ||
|
||
## Minimize webpage size | ||
|
||
In areas with weak signal strength, mobile data network can be slow and unstable, resulting in high latency. Hence, reducing the overall app package size and optimizing data transfers is critical. To reduce the page size, gather key performance metrics by running a performance audit using the **Performance** tab in dev tools. The performance audit helps identify bottlenecks and areas for improvement in your app. | ||
v-kushals marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Performance audit | ||
|
||
To run a performance audit, follow these steps: | ||
|
||
1. [Enable dev tools](../tabs/how-to/developer-tools.md#access-devtools-from-teams-android-client). | ||
|
||
1. Open dev tools and select **inspect** under your app. A new window opens. | ||
|
||
1. Select the **Performance** tab. You can see a performance marker indicating the time it takes for your app from Teams JavaScript SDK initialization to the `notifySuccess` call. You can use this marker to examine the network or local operations performed between `init()` and `notifySuccess`. | ||
|
||
In the following example, the **Timings** section shows that the app takes 2.20 seconds from Teams JavaScript SDK initialization to `notifySuccess`, makes two calls to get an authorization token, and makes a third API call that takes 1.5 seconds. | ||
|
||
:::image type="content" source="../assets/images/tabs/dev-tools-performance.png" alt-text="Screenshot shows the performance tab in dev tools." lightbox="../assets/images/tabs/dev-tools-performance-full.png"::: | ||
|
||
1. Select the **Lighthouse** tab. This tab provides insights into the app size and performance metrics. | ||
|
||
1. Under **Device**, ensure that you select **Mobile**. | ||
|
||
1. Select **Analyze page load**. | ||
|
||
:::image type="content" source="../assets/images/tabs/dev-tools-lighthouse.png" alt-text="Screenshot shows the lighthouse tab under dev tools." lightbox="../assets/images/tabs/dev-tools-lighthouse.png"::: | ||
|
||
The report shows various diagnostics for your app's webpage and a set of actionable insights to decrease page load. Ensure that you take the required steps to reduce the latencies flagged in this report. | ||
|
||
1. Select the **Coverage** tab. Your webpage might contain unused resources that don't provide any value to the functionality of the app. This tab allows you to see actual size and usage percentage of the resources on the webpage. | ||
|
||
1. If you can't find it in the home page of dev tools, go to **More tools** > **Coverage**. | ||
|
||
:::image type="content" source="../assets/images/tabs/enable-coverage-tools.png" alt-text="Screenshot shows how to enable coverage tools in dev tools." lightbox="../assets/images/tabs/enable-coverage-tools.png"::: | ||
|
||
1. You can use the report to remove unused code or resources. | ||
|
||
:::image type="content" source="../assets/images/tabs/coverage-tool-report.png" alt-text="Screenshot shows the report generated by the coverage tool." lightbox="../assets/images/tabs/coverage-tool-report.png"::: | ||
|
||
## See also | ||
|
||
* [Build tabs for Teams](../tabs/what-are-tabs.md) | ||
* [Create a tab](../tabs/how-to/create-personal-tab.md) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.