Optimize your app for 5G

Cell tower icon

Wi-Fi and LTE have long helped apps deliver connected experiences like video streaming, social networking, and online gaming — and 5G networking can provide even more opportunities to take advantage of high-bandwidth and low-latency connections in your app. Discover how you can optimize your existing app or build a new product from the ground up with 5G in mind so that you can move more data faster and deliver a great experience to people around the world.

Up your 5G game

One of the best ways you can take advantage of 5G’s high-performance characteristics is to offer multiple versions of an asset depending on someone’s network connection. If a person using your app is on a lower-bandwidth connection, your app can download or deliver files appropriate for that network; likewise, you can deliver higher-bandwidth assets when the connection supports it so that you can provide more information quickly. You can apply this to multiple different types of apps, including:

Streaming apps Video streaming apps can incorporate intelligent buffering and playback with AVFoundation to serve 4K (or 4K HDR) content to devices on 5G networks as well as lower-bandwidth options when connected to LTE.

Learn more about AVFoundation

Games Use the bandwidth available on 5G networks to deliver higher quality visuals and game play with larger texture maps and higher-poly models than you might otherwise on lower-bandwidth networks. Additionally, 5G’s lower-latency connection provides for faster overall play and state-saving actions between players and your server backend.

Learn more about SceneKit

Machine Learning apps If your app uses Core ML, you can improve both the speed and reliability of your on-device intelligence when connected to a 5G network by automatically retrieving larger .mlmodel and .mlarchive files from your server to run locally on someone’s device.

Core ML

AR apps While on 5G, you can provide a greater number of high-resolution objects within your ARKit scenes to provide a richer augmented experience for people interacting with your app. You can also use the extra bandwidth available over 5G networks to share even larger ARWorldMap and ARPointCloud objects in a shared AR experience — for instance, working collaboratively to lay out physical spaces with virtual objects from your app.

ARKit

Tune your transfers

Apple networking APIs automatically provide optimized management and performance for each platform and network type. In addition, you can further optimize your app to address potential cellular issues like movement speed and direction, cellular infrastructure demand, and interference.

Forget the network Because 5G networks typically offer better performance than Wi-Fi, it’s up to you to decide how your app best utilizes network resources — and you no longer need to rely on overall network type (cellular or Wi-Fi) to do so. Instead, you can use Constrained and Expensive to describe various network states. Each of these states relies on information from a person’s Data Mode choices (as defined in Settings > Cellular > Cellular Data Options) as well as their cellular plan restrictions.

isExpensive

isConstrained

For example, the network automatically switches to Constrained when someone enables Low Data Mode. When a person’s network is listed as Constrained, your app should minimize network data usage regardless of the value of Expensive. If the network is Expensive but not Constrained, your app should be considerate when fetching network resources while not imposing strict restraints. If the network is neither Constrained nor Expensive, your app can focus on providing the highest quality experience with minimal consideration for data usage.

Each networking framework uses the Constrained and Expensive indicators in specific ways. When using URLRequest, for example, your app can indicate which resource should be retrieved by setting the appropriate value on the allowsConstrainedNetworkAccess and allowsExpensiveNetworkAccess properties. In contrast, when using NWConnection, your app can access the state of the network through stateUpdateHandler as the isConstrained isExpensive properties of your connection’s currentPath. And, if your app uses AVFoundation instead of the Network framework or URLRequest, there are similar keys including AVURLAssetAllowsConstrainedNetworkAccessKey and AVURLAssetAllowsExpensiveNetworkAccessKey.

Regardless of technique, remember that the values for Constrained and Expensive are transient and can change as someone moves from one type of network connection to another. If your app dynamically monitors these changes, you’ll always provide the best experience for people, no matter their connection.

allowsExpensiveNetworkAccess

prohibitExpensivePaths

Provide a fallback Unless your app is designed specifically for a network with guaranteed performance characteristics, like a corporate or private connection, you should always make sure it functions well — even when there’s no network available at all. When someone initially downloads your app, make sure it delivers acceptable-quality assets as part of the bundle. If the app has periods of fast connectivity, you can then download higher-quality files and store them locally to ensure they're available when someone leaves network range or goes offline entirely.

Support your surroundings Most cellular providers have prioritized 5G rollouts in high-density areas: entertainment venues such as sports stadiums and amphitheaters, transportation hubs like train stations and airports, centers for business and education, and points of interest like public parks and tourist landmarks. When people recognize they’re in a high-performance networking location, they may want to explicitly enable caching and other features in your app before heading to a destination with reduced coverage — consider incorporating interface elements that notify and enable people to immediately download any relevant content

Take advantage of built-in frameworks Apple’s hardware and on-device frameworks are tuned to deliver advanced functionality in a power-efficient manner. For example, you can use Core ML for on-device intelligence instead of client-server round trips, or ARKit and the Vision framework for capturing, processing, and presenting insightful information in the field. On-device processing minimizes the need to exchange large amounts of data — let alone potentially personally identifiable information — and eliminates the need for having to connect to a back-end process in order to provide a useful service in your app.

When you do need to move large amounts of data, you can lean on Smart Data Mode for 5G-enabled devices. This feature monitors your app’s state along with any Apple frameworks you’re currently using to automatically switch between existing cellular frequencies in a manner that ensures your app receives the highest possible bandwidth — all without sacrificing battery life.

For example, when an app is in the foreground and playing video using the AVFoundation framework, Smart Data Mode ensures that high-bandwidth 5G is enabled. In addition, Smart Data Mode monitors the streaming experience while someone is connected to a 5G network. If the stream is throttled due to traffic shaping — either by the cellular provider or the limitations of your CDN — the feature will identify the throttled throughput and move the stream to an LTE connection to conserve power. Background requests for data using the core networking frameworks can be served just as well over LTE or lower power frequencies.

Get out there

Previously, testing your app’s networking code involved toggling the network state, switching between Wi-Fi and cellular data, and then using a network conditioner and other tools to alter various characteristics. While this is still a great way to test for basic use cases, nothing beats getting out and exploring the edge-case scenarios only a deployed network can throw your way.

Start small The App Store has a variety of apps you can use to determine the network characteristics for a given area. With one of these apps and a regional carrier’s wireless coverage map, you can track down the perfect spots in your area to ensure your app is selecting the correct resources at the right time. And once you’ve found that perfect 5G networking spot, move to another where your coverage is sub-optimal and check your app. Did it keep running? Did your streaming content degrade as expected or move to local resources? Did it deliver acceptable-quality assets after fresh install? The more real-world use cases you can test in advance, the better the experience overall will be for people around the world.

Go big While many third-party websites provide performance data for cellular networks, they are an aggregate statistic and only an approximation of the performance at the location where someone might be using your app. Because this data is only valuable as a baseline, it’s not a substitute for knowing how your app performs in the wild. You can use Testflight for iOS to scale your beta testing to people and networks around the world. You may also want to consider creating a TestFlight group — not only to ensure your app is bug-free, but that it performs well based on the overall network characteristics of the cohort you’ve assembled.

Move to the edge While the location of your server isn’t something you can always control, at least try to influence or decide where your server infrastructure resides and take steps to minimize the distance between your server and your app. When you reduce the distance between people and your backend, it can vastly improve the network performance of your app. One way you can improve your own app’s connection is by selecting a hosting provider that can federate your server back-end to map closely to the cellular networks your app uses. Alternatively, you may also want to consider using a few strategically-located CDNs.

Reach out

5G networks provide a real opportunity to enhance your existing app with richer data or build entirely new experiences that were previously not possible. If youʼre working on creating an amazing experience with 5G and would like to share it with us, let us know.

Contact us

Learn more about supporting 5G in your apps