get Mobile Network Name - Android Network

Android examples for Network:Network Operation

Description

get Mobile Network Name

Demo Code

//  Copyright (c) 2014 Texas Instruments. All rights reserved.
//package com.java2s;
import android.content.Context;

import android.telephony.TelephonyManager;

public class Main {
    public static String getMobileNetworkName(Context context) {
        TelephonyManager tm = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        String networkName = tm.getNetworkOperatorName();
        if (networkName != null) {
            return networkName;
        }/* w w  w . ja v a  2  s .c  o m*/
        return "";
    }
}

Related Tutorials