Skip to content

codetricity/theta_oct_2020_community_update

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

RICOH THETA Wi-Fi API October Community Update

Last updated October 21, 2020

This is a community document based on contributions of informal test results from the theta360.guide independent community. This is not an official RICOH document. For official information, please contact RICOH. You should confirm these community tips with your own tests prior to deployment in a business setting. As these are unofficial tips, the official RICOH THETA API may change unexpectedly and these techniques could stop working.

Problem Description and Fixes

For Android mobile applications targeting API 29, the Wi-Fi hotspot connection functions are deprecated. When using the NetworkSpecifier function, API calls to the RICOH THETA fail.

Credit and Thanks

Problem and solution were reported by saleh. Thank you!

Changes to Google Play Store Requirements

New Android apps must target Android 10, API level 29. From November 2, 2020, app updates will also need to target API level 29. Read more on the Android developer site.

Google Play Target Requirements

Potential Impact on THETA Developers

If your THETA app uses WifiNetworkSpecifier or WifiNetworkSuggestion when your customers' mobile phones connect to RICOH THETA cameras in Wi-Fi in Access Point (AP) mode, you may need to adjust your application.

Wi-Fi Restrictions

Problem is apparent if your app reduces the Wi-Fi setup steps to enhance the experience for your staff or customers.

Wi-Fi Archiecture

Example Problem

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);

Error

GET http://192.168.1.1/osc/info request will fail.

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)

Workaround

Bind the THETA camera for all outgoing traffic. Solution from saleh.

    private ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {

    @Override
    public void onAvailable(@NonNull android.net.Network network) {
        super.onAvailable(network);
        connectivityManager.bindProcessToNetwork(network);
        Timber.d("++++++ network connected - %s", network.toString());
    }};

This tip and many more SC2 developer articles are available on the SC2 Developers Community Site. Markdown to PDF conversion done with Grip.

This is not an official RICOH document. It is produced by an independent community. Please contact RICOH for official information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published