Jonathan Wise, Technical Evangelist for Amazon Kindle, is our guest blogger for this post.
Many apps these days now use back-end services or some form of network connectivity to provide customers with up-to-date information. While tablet apps usually work over Wi-Fi, tablet devices that provide cellular data connectivity, such as the Kindle Fire HD 8.9" 4G LTE, delight customers by providing the always-on connectivity they've come to expect from their smartphones. Many cellular plans have data limits, and it’s important to respect the user's cellular data plan when designing your tablet apps.
To ensure your apps best utilize the customer's data plan, we recommend the following best practices:
- Detect the network connection.
Make sure your apps detect the type of network connection available and branches its behavior accordingly. For example, it is important to reduce the frequency or resolution of data downloaded in the background when the device is connected to a cellular network. To detect which type of network connection a customer is using, you can use the following code.
final ConnectivityManagerconnectManager = (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();
- Block file transfers in excess of 50MB.
If a user tries to transfer a file in excess of 50MB while on cellular data, the app should provide an alert and abort the transfer. For consistency with first-party apps on the Kindle Fire HD 8.9" 4G LTE, we recommend using the following alert text:
"This item is over50MB and cannot be downloaded [or uploaded] over your Mobile Network connection. Please connect to a WiFi network to download [or upload] it."
You should also provide two buttons: one to Dismiss the warning,and the other to take the user to his or her Wireless & Networks network settings activity to enable connection to WiFi, if available. To open the Wireless& Network settings panel from your code, add the following:
- Alert users of streaming audio or video.
When a user initiates streaming of audio or video over a cellular data connection, the app should alert him or her of the possible consequences before proceeding. For consistency with other Amazon apps on the Kindle Fire HD 8.9" 4G LTE, we recommend using the following alert text:
"It is recommended that you connect to a WiFi network when streaming media, to avoid excessive data use. Do you want to stream over your Mobile Network connection?"
You should also provide two buttons: one to Continue and another to Cancel. When the user clicks Cancel, do not stream the media.
- Gracefully handle the loss of connectivity.
When a customer consumes the monthly data plan on a Kindle Fire HD 8.9" 4G LTE, and has not purchased additional data, his or her cellular data connection will be disabled. The platform will manage alerts regarding data plan consumption, but your apps should gracefully handle the loss of connectivity -- both over Wi-Fi and over cellular data.
Following these best practices not only helps improve the user experience of your apps by protecting customers from inadvertent data consumption, it also helps ensure users feel safe using your apps on their Mobile Network-enabled device, no matter what network they're using.