gru

2

Game developer tip 6 and 7: Detecting Wi-Fi™ and checking the SD card

Tip6and7_featureimage_85percent
Tip6and7_featureimage_85percent

We’ve added some new, and very important tips to the Xperia™ Game Developer Recommendations list. The first recommendation is that your app should check for a Wi-Fi™ connection, which benefits users who may have a limited data plan and helps carriers reserve network bandwidth for other services. The second recommendation is that your app should check the status of the SD card. This is important since the SD card automatically unmounts when the back cover of the device is removed and may cause the SD card to become unreadable. Read on for more details.

We’ve recently updated our Xperia Game Developer Recommendations list with two important developer tips that you should keep in mind when designing your app or game – detecting Wi-Fi™ and checking the SD card.

Tip #6 – Detecting Wi-Fi™ (AP16)

We highly recommend that you ensure that your application automatically checks for a Wi-Fi™ connection for the user before downloading starts, and if there is no Wi-Fi™ connection, the application should ask the user if the download should continue. This benefits users who might be on a monthly data plan, this gives them the opportunity to consider whether it’s worth the time and cost to download immediately, or wait till they have a Wi-Fi™ connection before proceeding. This also helps phone carriers, since their networks are not overburdened with bandwidth coming from requests made using 3G or LTE.

You can use the following code example to check for Wi-Fi™ before the download starts:

    private static boolean isConnected(Context context) {

        ConnectivityManager connectivityManager = (ConnectivityManager)

            context.getSystemService(Context.CONNECTIVITY_SERVICE);

        NetworkInfo networkInfo = null;

        if (connectivityManager != null) {

            networkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

        }

        return networkInfo == null ? false : networkInfo.isConnected();

Tip #7 – Checking the SD card (AP17)

It’s important that state of the SD card be ready each time before it is read or written to. This can happen when the back cover of the device is loose or removed, in which case the SD card automatically becomes unmounted. If the application was to attempt to access the SD card when it’s not ready, the users risk the chance of damaging the SD card and rendering it unreadable and unusable. Therefore, it’s safer that you design the application to check the state of the SD card before it’s written to, and if the SD is not available, then the application should show an error message or take some corrective action.

The following code can be used to check the state of the SD card:

Environment.getExternalStorageState()

You can always refer back to the full list

These tips we just mentioned are part of a larger set of Xperia Game Developer Recommendations, all designed to help you ensure a consistent level of quality in the Android™ games you develop. Remember, these are not requirements that have to be met to pass a certification process, but are simply there to guide you in your game development. Ultimately, it’s up to you to consider how each recommendation pertains to a game you develop for an Xperia™ device.

More information

Źródło: Game developer tip 6 and 7: Detecting Wi-Fi™ and checking the SD card



Category: Sony Ericsson | Tags: None

Related Posts

  • No related posts found.



You must be logged in to post a comment.

Name (wymagane)

Email (wymagane)

Witryna internetowa

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Share your wisdom

wielkoformatowe wydruki Lublin kolorowe wielkoformatowe skanowanie kolorowe skanowanie Lublin drukowanie skanowanie kolor lublin wydruki lublin wielki format skan serwis ekspresów serwis SAECO Lublin w Lublinie drukowanie projektów w lublinie