How to make a network connection using a selected Access Point in Java ME

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Java Runtime 1.4
Created: ektasrv (30 Aug 2010)
Last edited: hamishwillee (25 Jul 2013)



How to make a network connection using a selected Access Point in Java ME?


Use IAPInfo API 1.0, available on devices with Java Runtime 1.4 to access Internet Access point information from the native database and use it with GCF, by appending the access point's ID to the URL before passing it to Java Generic Connection Framework.

Sample Code


import com.nokia.mid.iapinfo.*;

Get APN id & make connection

public StreamConnection getConnection(String APN_Name, String url) throws Exception
//Obtain IAPInfo object by factory
IAPInfo iapinfo = IAPInfo.getIAPInfo();
//Get APN
AccessPoint ap = iapinfo.getAccessPoint(APN_Name);
//Make connection using selected access point, selected access point's ID is append to URL which is passed to GCF
StreamConnection sc = (StreamConnection)Connector.open(ap.getURL(url));
return sc;


Check your target device spec's (http://www.developer.nokia.com/Devices/Device_specifications/?filter1=all) for support of IAPInfo API on it before using it.

This page was last modified on 25 July 2013, at 13:47.
47 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.