Partilhar via


Optimizing the download of apps with Resource Packages

Creating rich multi-language or multi-scale experiences for your UWP apps is highly encouraged; it means a better experience for users and a broader overall reach to Windows consumers across the globe. However, it comes with a cost, all users need to download those additional assets. In Windows 10 UWP, using some neat features, you can reduce the download size of your UWP app without any user impact!

Resource Packages allow the Windows 10 UWP to seamlessly split out each language or scale asset, into a separate package that can be downloaded if needed (depending on configuration of the device). This is all 100% transparent to the user and in most cases the user doesn’t know or care – nor should they!

The Resource Package process is split into two basic phases - resource creation and resource delivery.

 

create-submit

Creating Resources

Separating Resources

Separating resource assets is pretty simple, you must add a specific string to the name of the asset (be it file or folder of assets). For language assets you’ll need to include the BCP-47 language tag (find all languages here) and for scale assets, you'll include the string "scale-xxx" (find all scales here). For example, if your app had a French asset (intended for France) that was named "myasset.txt" it's name would change to "myasset_fr-fr.txt." And for a Scale 150 asset that was named "myasset.jpg" it's name would change to "myasset_scale-150.jpg."

 

Once this is done, naturally, your next step will be to make the necessary adjustments to your code to account for the change in file and folder names.

Repackaging Resources

Once the naming is done, the resource repackaging is very simple and straightforward. In Visual Studio  in the package creation wizard just select always to build the .appxbundle automatically as part of your output. This .appxbundle file that’s created can be submitted to the Windows Store as you would normally submit your .appx file.

RP-2

 

If you have a more complex build environment, please refer to the makeappx.exe and makepri.exe documentation for details on how to build the .appxbundle file.

Delivering Resources

 

acquire

Optimized Acquisition

Now that your app is in the Store, users who install your app will only get the resource packages they need! For example, French users on a Scale 150 device will only receive those resources. They will no longer waste time, network bandwidth and on device space for resources they’ll never user.

Continuous Automatic Updates

Added a new language / scale resource? Windows 10 handles this with ease, users who apply for that new resource will get it at the next update interval.

User update their language / scale settings after the app was already acquired? Also, not a problem. Windows 10 will detect these changes and acquire the newly applicable resources at the next update interval.

Happy optimized app building!

Jason Salameh, Senior Program Manager – Windows Developer Platform