How to use URL class in blackberry

I am engaged in a streaming application for Blackberry. I have an Android code for an application. I need to implement in BlackBerry now. So in the Android code they import packages, namely

import java.net.HttpURLConnection;
import java.net.URL;

which are not supported in blackberry. For HttpURLConnectionI found the appropriate class in the blackberry api, named it HttpsConnection. But for the URL class, I cannot find the corresponding class in the blackberry api. Detailed help.

+3
source share
1 answer

Use these packages:

import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;

and open the connection as follows:

String urlString = "http://www.myserver.com/myresource/somethinghere";
HttpConnection httpConnection = (HttpConnection) Connector.open(urlString);
java.io.InputStream inputStream = httpConnection.openInputStream();
0
source

Source: https://habr.com/ru/post/1774342/


All Articles