I'm developing an app which needs to connect to a specific wifi network with internet capabilities. My app targets Android 10 devices and I'm writting it in java. I took inspiration from this post: https://blog.ostebaronen.dk/2019/11/android-10-wifi.html (Thanks @Cheesebaron).
I can't find a suitable java translation (line or set of lines in java programming language) for the next line
NetworkAvailable?.Invoke(network);
which connects the device. The Invoke method is called in the OnAvailable method.
final ConnectivityManager.NetworkCallback networkCallback =
new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(@NonNull Network network) {
super.onAvailable(network);
// connect to network
Log.i(TAG, "Connected to network with WIFI capabilities");
}
...
};
(I've include the necessary permissions in android manifest)