Returns a constant indicating the device phone type. - Android Android OS

Android examples for Android OS:Device

Description

Returns a constant indicating the device phone type.

Demo Code


//package com.java2s;
import android.content.Context;
import android.telephony.TelephonyManager;

public class Main {
    /**/*from   www .  j  av a  2s.com*/
     * Returns a constant indicating the device phone type. This indicates the
     * type of radio used to transmit voice calls.
     * 
     * @param context
     * @return The phone type.
     */
    public static int getPhoneType(final Context context) {
        final TelephonyManager tm = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        if (null == tm)
            return TelephonyManager.PHONE_TYPE_NONE;

        return tm.getPhoneType();
    }
}

Related Tutorials