Namespaces
Variants
Actions

How to make a network connection using a selected Destination Network in J2me

Jump to: navigation, search
Article Metadata

Tested with
Devices(s): Java Runtime 1.4

Compatibility
Platform(s): MIDP 2.0

Article
Keywords: IAPInfo, APN, DN, Access point, Destination Network
Created: ektasrv (30 Aug 2010)
Last edited: hamishwillee (11 Jul 2012)

Contents

Problem

How to make a network connection using a selected Destination Network in Java ME?

Solution

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


Sample Code

Imports

import com.nokia.mid.iapinfo.*;

Get DN id & make connection

public StreamConnection getConnection(String DN_Name, String url) throws Exception
{
//Obtain IAPInfo object by factory
IAPInfo iapinfo = IAPInfo.getIAPInfo();
//Get Destination Network
DestinationNetwork dn = iap.getDestinationNetwork(DN_Name);
//Make connection using selected Destination Network, selected Destination Network's ID is append to URL which is passed to GCF
StreamConnection sc = (StreamConnection)Connector.open(dn.getURL(url));
return sc;
}

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.

This page was last modified on 11 July 2012, at 09:22.
68 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved