×
Namespaces

Variants
Actions

How to get all Access Points in Java ME

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Java Runtime 1.4
CompatibilityArticle
Keywords: IAPInfo, APN, DN, Access point, Destination Network
Created: ektasrv (30 Aug 2010)
Last edited: hamishwillee (25 Jul 2013)

Contents

Problem

How to get a List of all Access Points in J2me ?

Solution

Use IAPInfo API 1.0, available on devices with Java Runtime 1.4 to access Internet Access point information from the native database.


Sample Code

Imports

import com.nokia.mid.iapinfo.*;

List all available APNs

public getAPNList() throws IAPInfoException
{
//Obtain IAPInfo object by factory
IAPInfo iapinfo = IAPInfo.getIAPInfo();
//Get list of available Destination Networks
DestinationNetwork dnetworks[] = iapinfo.getDestinationNetworks();
//Get list of access points from each destination network
for(int i=0;i<dnetworks.length;i++)
{
DestinationNetwork dn = dnetworks[i];
AccessPoint aps[];
// if Destination Network is not null, get list of APN in it.
if(dn ! = null)
{
aps = dn.getAccessPoints();
for(int j=0;i<aps.length;j++);
{
AccessPoint ap=aps[j];
// if APN is not null, get its name
if(ap != null)System.out.println(ap.getName());
}
}
}
}

Note

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.

--Submitted by Meetu Ekta at 21:50(IST), 30 August 2010.

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