Example usage for android.location Country getCountryIso

List of usage examples for android.location Country getCountryIso

Introduction

In this page you can find the example usage for android.location Country getCountryIso.

Prototype

@UnsupportedAppUsage
public final String getCountryIso() 

Source Link

Usage

From source file:com.android.mms.ui.MessageUtils.java

public static String detectCountry() {
    try {/*from  www .  j  a  va 2s  . co m*/
        CountryDetector detector = (CountryDetector) MmsApp.getApplication()
                .getSystemService(Context.COUNTRY_DETECTOR);
        final Country country = detector.detectCountry();
        if (country != null) {
            return country.getCountryIso();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}