1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.chromium.content.common;
7 import android.content.Context;
8 import android.telephony.TelephonyManager;
10 import org.chromium.base.CalledByNative;
13 * This class facilitates access to the current telephony region,
14 * typically only available using the Java SDK.
16 public class DeviceTelephonyInfo {
18 private TelephonyManager mTelManager;
20 private DeviceTelephonyInfo(Context context) {
21 Context appContext = context.getApplicationContext();
22 mTelManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE);
26 * @return The ISO country code equivalent of the current MCC.
29 public String getNetworkCountryIso() {
30 return mTelManager.getNetworkCountryIso();
34 * Creates DeviceTelephonyInfo for a given Context.
35 * @param context A context to use.
36 * @return DeviceTelephonyInfo associated with a given Context.
39 public static DeviceTelephonyInfo create(Context context) {
40 return new DeviceTelephonyInfo(context);