how to get a list of available gsm networks?

2019-06-28 01:04发布

问题:

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.