Ricoh Theta Android app connection issue using Android API 29

Using an Android device I connect to the Theta camera to shoot 360 photos. Till API level 28, our existing code works fine, but with the new API 29, wifi(hotspot) connection functions are deprecated and with the new NetworkSpecifier function, I can connect to the device; but I can’t not make any API request to the Theta camera.

Like GET http://192.168.1.1/osc/info request always fail, even in mobile web-browser.
Error Message:

Caused by: java.net.ConnectException: failed to connect to /192.168.1.1 (port 80) from /:: (port 0) after 10000ms: connect failed: ENETUNREACH (Network is unreachable)

Here is my code snap to connect to the Theta camera.

final WifiNetworkSpecifier specifier = new WifiNetworkSpecifier.Builder()
             //.setSsidPattern(new PatternMatcher(ssid, PatternMatcher.PATTERN_PREFIX))
               .setSsid(ssid)
               .setWpa2Passphrase(passPhrase)
               .setBssid(MacAddress.fromString(i.BSSID))
               .build();
               
final NetworkRequest request = new NetworkRequest.Builder()
                        .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
                        .removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                        .setNetworkSpecifier(specifier)
                        .build();

final ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

final ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {
            @Override
            public void onAvailable(@NonNull android.net.Network network) {super.onAvailable(network);}
            @Override
            public void onUnavailable() { super.onUnavailable();}
            @Override
            public void onLost(@NonNull android.net.Network network) { super.onLost(network);}
        };
//connectivityManager.registerNetworkCallback(request, networkCallback);
connectivityManager.requestNetwork(request, networkCallback);

As I said, i can connect to the Theta camera and my Android device wifi connection shows, ‘Connected via MyApp’. But the API’s to communicate with the device always fail. NOW, if I manually connect the device by going into my device wifi settings and select the Theta camera.

A post was merged into an existing topic: Android: Ricoh Theta connection issue using Android API 29