Use A Socket Connection - Blackberry JAVA DEVELOPMENT ENVIRONMENT - - DEVELOPMENT GUIDE Manual

Version: 4.7.0
Hide thumbs Also See for JAVA DEVELOPMENT ENVIRONMENT - - DEVELOPMENT GUIDE:
Table of Contents

Advertisement

Development Guide
3.
Use the CoverageInfo class and CoverageStatusListener interface of the
net.rim.device.api.system package to make sure that the BlackBerry device is in a wireless network coverage
area.
4.
Invoke Connector.open(), specifying HTTPS as the protocol and cast the returned object as an
HttpsConnection object to open an HTTP connection.
HttpsConnection stream = (HttpsConnection)Connector.open("https://host:
443/");
5.
To specify the connection mode, add one of the following parameters to the connection string that passes to
Connector.open()
• Specify that an end-to-end HTTPS connection must be used from the BlackBerry device to the target server:
EndToEndRequired
• Specify that an end-to-end HTTPS connection should be used from the BlackBerry device to the target server. If the
BlackBerry device does not support end-to-end TLS, and the BlackBerry device user permits proxy TLS connections, then
a proxy connection is used: EndToEndDesired.
HttpsConnection stream = (HttpsConnection)Connector.open("https://host:443/;EndTo

Use a socket connection

Although you can implement HTTP over a socket connection, you should use an HTTP connection for the following reasons:
Socket connections do not support BlackBerry® Mobile Data System features, such as push.
BlackBerry® device applications that use socket connections typically require significantly more bandwidth than BlackBerry
device applications that use HTTP connections.
1.
Import the following classes:
• net.rim.device.api.system.CoverageInfo
• javax.microedition.io.Connector
• java.lang.String
• java.io.OutputStreamWriter
• java.io.InputStreamReader
2.
Import the following interfaces:
• net.rim.device.api.system.CoverageStatusListener
• javax.microedition.io.StreamConnection
3.
Use the CoverageInfo class and CoverageStatusListener interface of the
net.rim.device.api.system package to make sure that the BlackBerry device is in a wireless network coverage
area.
4.
Invoke Connector.open(), specifying socket as the protocol and appending the deviceside=false parameter to the
end of the URL.
Connections
57

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment

Table of Contents