Q:

How to get the Access Point Name in Android?

I would like to know, how do we get the access point name from an Android Phone.
Thanks,
Sana.
EDIT:
WifiManager mWiFiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo w = mWiFiManager.getConnectionInfo();
Toast.makeText(this, "APN Name = "+w.getSSID(), Toast.LENGTH_SHORT).show();

The above code snippet is for current active APN name.
Thanks tdelev

A:

I suppose you are referring to a WiFi Access Point so this is the code you can use to achieve that:
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mWiFiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);

        registerReceiver(mWiFiBroadcastReceiver, intentFilter);
    }

   final BroadcastReceiver mWiFiBroadcastReceiver = new BroadcastReceiver() {

    @Override
    public void onReceive(Context context, Intent intent) {
        mScanResults = mWiFiManager.getScanResults();
        StringBuilder sb = new StringBuilder();
        for (ScanResult sr : mScanResults) {
            sb.append("ACCESS POINT NAME: " + sr.SSID);
            sb.append("\n");
            sb.append("BSSID: " + sr.BSSID);
            sb.append("\n");
            sb.append("SIGNAL: " + sr.level);
            sb.append("\n");

        }
        String info = sb.toString();
    }

};

Hope this helped you.

