Data Transfers and Mobile Networks
- Check for a Mobile Network Connection
- Streaming Media
- Background Transfers
- Lack of Connectivity
- Tablets with Bundled Plans
In addition to Wi-Fi connectivity, the Fire phone, Fire HDX 8.9 (4th Generation), Kindle Fire HDX 8.9" (3rd Generation), Kindle Fire HDX 7" (3rd Generation), and the Kindle Fire HD 8.9" 4G (2nd Generation) tablet can connect to mobile networks if the user has a mobile network plan. By default, these devices connect to Wi-Fi. However, if a Wi-Fi connection is not available and the user has a mobile network plan, the devices connect to the mobile network. For Fire phone and Fire tablets (3rd and 4th Generation), the user must purchase a plan from a carrier. The Kindle Fire HD 8.9" 4G (2nd Generation) tablet includes a bundled mobile network plan.
Some plans have limits on the amount of data that can be transferred per month, or in some cases, over a three month period. When the users reach the data limit, they may incur overage charges or the connection may shut down.
Data transfers also consume power. Using the cellular network to download or upload content requires more power than doing the same transfer over Wi-Fi. Minimize network traffic to conserve power. For example, if your app downloads content, have the app perform its downloads in the background. You can also batch up your network transmissions to minimize power. Your app consumes less power by transmitting all of its data over a short period of time than by transmitting smaller amounts of data intermittently over a long period of time.
To help users remain within their data plan limits and conserve power, observe the following considerations.
Check for a Mobile Network Connection
Before your app transfers files or data, check whether the device is connected to a mobile network. In the following code, if isWIFIConnected is true, the device is connected to Wi-Fi. If isWANConnected is true, the device is connected to the mobile network.
final ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = connectManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); boolean isWANConnected = netInfo.isConnected(); NetworkInfo netInfo = connectManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); boolean isWIFIConnected = netInfo.isConnected();
If the device is connected to Wi-Fi, you don't need to limit data transfers. However, if the device is connected to the mobile network, it should avoid large data transfers without giving the user the choice whether to proceed.
Streaming media can rapidly consume the user's data allowance. If your app uses streaming media, alert the user before initiating the connection. For consistency, include these features in your alert:
The following text.
It is recommended that you connect to a Wi-Fi network when streaming media, to avoid excessive data use. Do you want to stream over your mobile network connection?
Buttons that give the user the option of canceling or continuing.
If the user chooses to continue, consider using lower resolution and streaming smaller files to conserve the user's transfer quota.
Avoid silently transferring data when the device is connected to the mobile network. Instead, batch data and transfer it when the device is connected to a Wi-Fi network. If this is not possible, consider alerting the user and giving the option of continuing the transfer or of waiting for a Wi-Fi connection.
Lack of Connectivity
Because the mobile network connection may shut down when the data limit is reached, your app must deal with the lack of connectivity gracefully. Alert the user when it is not possible to transfer data.
Tablets with Bundled Plans
The Kindle Fire HD 8.9" 4G (2nd Generation) tablet includes a bundled mobile network plan. This plan has a monthly quota of 250 MB of transferred data and a limit of 50 MB for any single data transfer.
Because of the single-transfer limit, your app should never attempt to download a file larger than 50 MB over the mobile network. A transfer larger than 50 MB will fail. Your app should instead display an alert. For consistency with other Fire apps, implement an alert with these features:
The following text, with logic that chooses "download" or "upload" as appropriate.
This item is over 50MB and cannot be downloaded over your Mobile Network connection. Please connect to a Wi-Fi network to download it.
This item is over 50MB and cannot be uploaded over your mobile network connection. Please connect to a Wi-Fi network to upload it.
- A button to dismiss the alert and cancel the transfer.
- A button for connecting to a Wi-Fi network, if one is available.
You can use the following code to initiate a Wi-Fi connection.
For transfers smaller than 50 MB that use a significant portion of the user's monthly quota, your app should alert the user and offer the option of connecting to Wi-Fi or continuing over the mobile network. A good threshold is a transfer of 5 MB or greater.