I am working on custom ROM project and there is requirement to create service which can continues connected with our cloud server via Websocket or socket or MQTT like Google service is doing. For this use I have created AOSP system service.
I have successfully created system service inside the custom ROM and it's working fine but on this class I am unable to access websocket or HTTPAPIs. Whenever I am going to access those APIs the the aosp build was going to failed and throwing exception as below.
error: package java.net.http does not exist
import java.net.http.HttpClient;
error: package java.net.http does not exist
import java.net.http.WebSocket;
How can I access websocket and http APIs in android system service?
I am using Android-11 source code.
java.net.http.HttpClient
was added in Java 11, but Android only supports Java 8 code. The full list of classes on Android is documented here: developer.android.com/reference/classes – Cavalla