how to get a list of available gsm networks?

痞子三分冷 提交于 2019-12-23 13:03:38

问题


i'm currently writing on some piece of code in android 2.1 that is supposed to measure the signal strength of the gsm signals. what i need is some kind of list with some kind of network IDs matching the corresponding signal strengthes... i got this far:

public class main extends Activity {
    TelephonyManager telManager;
    GSMListener gsmListener;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        gsmListener = new GSMListener();

        telManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        telManager.listen(gsmListener ,PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);

    }

    private class GSMListener extends PhoneStateListener {
        /* Get the Signal strength from the provider, each time there is an update */
        @Override
        public void onSignalStrengthsChanged(SignalStrength signalStrength) {
            super.onSignalStrengthsChanged(signalStrength);

            Toast.makeText(main.this, "GSM Cinr: " + signalStrength.getGsmSignalStrength(), Toast.LENGTH_SHORT).show();
        }
    };
}

but at this point, i wonder if there's network-id like the bssid for wifi networks? how is this handled with gsm? i need to identify the gsm network i'm getting the signal strength of.

EDIT:

by "network-id", meant "cell-id". what i need is a list of *all available* gsm networks in range and their reception quality. the operator-id is not of much interest to me, as i need to identify cell AND network, i'm getting the signal strength from.


回答1:


Every operator has a unique ID, a 5 digit number called PLMN (Public land mobile network).

That number consists of a 3-digit MCC (Mobile Country Code) followed by a 2-digit MNC (Mobile Network Code).

The wikipedia list is a relatively complete list.



来源:https://stackoverflow.com/questions/3169541/how-to-get-a-list-of-available-gsm-networks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!