Add 5G capabilities to your app

Android 11 adds functionality to support 5G in your apps. This topic covers the functionality and gives you an overview of how adding 5G-specific functionality to your app can improve the user experience.

Build for 5G

When deciding how to engage with 5G, think about what types of experiences you are trying to build. Some ways that 5G can enhance your app include:

  • Automatically make current experiences faster and better because of the speed and latency improvements of 5G.
  • Up-level the user experience, such as by showing 4k video or downloading higher-resolution game assets.
  • After confirming that the increased data usage won't cost the user, include experiences normally only provided over Wi-Fi, such as proactively download content typically reserved for unmetered Wi-Fi.
  • Provide experiences unique to 5G that work only with high speeds and low latency.

5G functionality

Android 11 introduces the following functionality changes and enhancements:

Check meteredness

The NET_CAPABILITY_TEMPORARILY_NOT_METERED is a capability added in Android 11 that tells you if the network you are using is unmetered based on information provided by cellular carriers.

The new flag is used alongside NET_CAPABILITY_NOT_METERED. The existing flag indicates if a network is always unmetered, and applies to both Wi-Fi and cellular connections.

The difference between the two flags is NET_CAPABILITY_TEMPORARILY_NOT_METERED may change without the network type changing. Apps that target Android 11 can use the NET_CAPABILITY_TEMPORARILY_NOT_METERED flag. On devices running on Android 9 and lower, the OS will not report on the flag. For apps running on Android 10, this flag may be available, depending on the device it is running on.

Once you've determined that the current network is temporarily or permanently unmetered, you can display higher-resolution content (such as 4k video), upload logs, back up files, and proactively download content.

The following sections cover the steps to add meteredness-checking to your app.

Register a network callback

Register for a network callback using ConnectivityManager.registerDefaultNetworkCallback() to hear when NetworkCapabilities change. You can detect changes to NetworkCapabilities by overriding the onCapabilitiesChanged() method in your NetworkCallback.

registerDefaultNetworkCallback() causes the registered callback to trigger immediately when registered, giving the app info about the current state. Future callbacks are critical for the apps to take appropriate action when the state is changing from unmetered to metered or the other way around.

Check for meteredness

Use the NetworkCapabilites object that you receive in a network callback to check the output of the following code:


NetworkCapabilities.hasCapability(NET_CAPABILITY_NOT_METERED) ||


NetworkCapabilities.hasCapability(NET_CAPABILITY_NOT_METERED) ||

If the value is true, then you can treat the network as unmetered.

Additional considerations

When working with this functionality, keep the following in mind:

  • Using the NET_CAPABILITY_TEMPORARILY_NOT_METERED flag requires that you compiled your app against the Android 11 SDK.

  • The NET_CAPABILITY_NOT_METERED capability is permanent on a network. A network with this capability will disconnect automatically if it loses the capability (becomes metered).

  • In contrast, NET_CAPABILITY_TEMPORARILY_NOT_METERED may change on a network without disconnecting. Therefore, apps must listen for the onCapabilitiesChanged() callback to handle when the network returns to its metered status (loses the NET_CAPABILITY_TEMPORARILY_NOT_METERED capability).

  • A network can't have both NET_CAPABILITY_NOT_METERED and NET_CAPABILITY_TEMPORARILY_NOT_METERED at the same time.

5G detection

Starting in Android 11, you can detect if the device is connected to a 5G network using a callback-based API call. You can check for whether the connection is a 5G NR (standalone) or NSA (nonstandalone) network.

Some uses for this API call may include:

  • Displaying 5G branding in your app to highlight that you're offering a unique 5G experience.

  • Activating a unique 5G experience in the app only when on a 5G network. You should pair this status check with checking for meteredness.

  • Keeping track of 5G connections for analytics purposes.

To test 5G detection without a 5G device, you can use features added to the Android SDK emulator.

Detect 5G

Call TelephonyManager.listen(), passing in LISTEN_DISPLAY_INFO_CHANGED, to determine if the user has a 5G network connection. Override the onDisplayInfoChanged() method to determine the type of network used for display purposes. One exception is that if the carrier opts to show 5G as the RAT for their mmWave network, OVERRIDE_NETWORK_TYPE_NR_NSA is returned.

The following table shows the networks that correspond to the values:

Return type Network
OVERRIDE_NETWORK_TYPE_NR_NSA NR (5G) for 5G Sub-6 networks

Bandwidth estimation

Bandwidth estimation uses the NetworkCapabilities object that you work with when determining meteredness. You can get bandwidth estimates using that object.

The reliability and accuracy of the bandwidth estimation methods getLinkDownstreamBandwidthKbps() and getLinkUpstreamBandwidthKbps() improve in Android 11 due to upgrades to framework support and platform/modem bug fixes to accommodate 5G.

Bandwidth defaults provide guidance on app start-up only. This should help you with the “start-up on idle” scenario. Your app should measure what it sees once your users have started engaging with the app and adjust its streaming behavior dynamically. For example, you may choose the resolution of video to provide based on the bandwidth estimation at startup. Continue checking the estimates as your users use the app; as their connection type and strength changes, adjust your app's behavior accordingly.