Android device setup SDK "Could not find Network for SSID Photon-..."

Ok so I’ve done a lot of searching and haven’t found anyone else having the same issue, so once again I must be doing something stupid. Going through the ParticleDeviceSetupLibrary.startDeviceSetup (SDK version 0.6.0), it sees my photon in listening mode, I select it and it tries to connect but fails with an error pop-up:

Error
Please try running setup again after resetting your Photon and putting it back in blinking blue listen mode if needed.

The relevant log bits:

D/WifiScanResultLoader: Received WifiManager.SCAN_RESULTS_AVAILABLE_ACTION broadcast
D/WifiScanResultLoader: Latest (unfiltered) scan results: [...: Photon-VF73WK, BSSID: ***, capabilities: [ESS], level: -66, frequency: 2462, timestamp: 634778747045, distance: ?(cm), distanceSd: ?(cm), passpoint: no, ChannelBandwidth: 0, centerFreq0: 0, centerFreq1: 0, 80211mcResponder: is not supported, Carrier AP: no, Carrier AP EAP Type: -1, Carrier name: null, Radio Chain Infos: null, ...]
D/WifiListFragment: new scan results: [io.particle.android.sdk.devicesetup.model.ScanResultNetwork@c1e7a3d1]
D/WifiFacade: No network found (returning -1) for SSID: Photon-VF73WK
D/WifiFacade: Currently connected to: Mars, supplicant state: COMPLETED
V/SoftAPConfigRemover: onWifiNetworkDisabled() Mars
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
D/ApConnector: WIFI_INFO: null
D/ApConnector: Adding network Photon-VF73WK
D/WifiFacade: addNetwork with SSID "Photon-VF73WK": * ID: -1 SSID: "Photon-VF73WK" PROVIDER-NAME: null BSSID: null FQDN: null PRIO: 999999 HIDDEN: false
               NetworkSelectionStatus NETWORK_SELECTION_ENABLED
               hasEverConnected: false
               KeyMgmt: NONE Protocols:
               AuthAlgorithms:
               PairwiseCiphers:
               GroupCiphers:
               PSK: 
              Enterprise config:
              IP config:
              IP assignment: UNASSIGNED
              Proxy settings: UNASSIGNED
               cuid=-1 luid=-1 lcuid=0 userApproved=USER_UNSPECIFIED noInternetAccessExpected=false 
              recentFailure: Association Rejection code: 0
I/ApConnector: Added network with ID 22 successfully
I/ApConnector: Enabling network Photon-VF73WK with network ID 22
D/WifiFacade: enableNetwork for networkID 22
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
D/ApConnector: WIFI_INFO: null
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
               WIFI_INFO: null
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
               WIFI_INFO: null
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: CONNECTING/CONNECTING, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
               WIFI_INFO: null
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: CONNECTING/CONNECTING, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
               WIFI_INFO: null
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: CONNECTING/OBTAINING_IPADDR, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
               WIFI_INFO: null
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: CONNECTING/OBTAINING_IPADDR, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
               WIFI_INFO: null
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
               WIFI_INFO: null
D/ApConnector: Received android.net.wifi.STATE_CHANGE
D/ApConnector: EXTRA_NETWORK_INFO: [type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
               WIFI_INFO: null
...
D/DiscoverDeviceActivity: Waiting a couple seconds before trying the socket connection...
I/CommandClient: Preparing to send command 'device-id'
I/CommandClient: *** BUILT COMMAND DATA: 'device-id\n0\n\n'
D/EZ: Can't close closable, arg was null.
D/DiscoverDeviceActivity: Setup exception thrown: 
                          io.particle.android.sdk.devicesetup.setupsteps.SetupStepException: Process died while trying to get the device ID
                              at io.particle.android.sdk.devicesetup.ui.DiscoverProcessWorker.doTheThing(DiscoverProcessWorker.java:54)
                              at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:326)
                              at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:316)
                              at android.os.AsyncTask$2.call(AsyncTask.java:333)
                              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                              at java.lang.Thread.run(Thread.java:764)
                           Caused by: io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory$SocketBindingException: Could not find Network for SSID Photon-VF73WK
                              at io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory.bindSocketToSoftAp(NetworkBindingSocketFactory.java:90)
                              at io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory.buildSocket(NetworkBindingSocketFactory.java:77)
                              at io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory.createSocket(NetworkBindingSocketFactory.java:45)
                              at io.particle.android.sdk.devicesetup.commands.CommandClient.sendAndMaybeReceive(CommandClient.java:55)
                              at io.particle.android.sdk.devicesetup.commands.CommandClient.sendCommand(CommandClient.java:44)
                              at io.particle.android.sdk.devicesetup.ui.DiscoverProcessWorker.doTheThing(DiscoverProcessWorker.java:48)
                              at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:326) 
                              at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:316) 
                              at android.os.AsyncTask$2.call(AsyncTask.java:333) 
                              at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
                              at java.lang.Thread.run(Thread.java:764) 

This is running on Android hardware not the emulator. When I try the same with the official Particle app (on the same hardware) it works though. There must be something wrong in my code, but it’s not obvious from the these logs.

Don’t worry, it’s not your code. There was a change in Android which caused this originally. The fix published in the Particle app but the updated device setup lib wasn’t published until now.

That new version is rolling out now as 0.6.1. Please speak up if you’re still having trouble after trying 0.6.1!

1 Like

You know, I did read that comment:

Android doesn’t have any means of directly asking "I want the Network obj for the Wi-Fi network with SSID ". Instead, you have to infer it based on a field. Let’s hope that the behavior of “NetworkInfo.getExtraInfo()” doesn’t ever change…

and wondered if something did indeed change :laughing:

Thanks Jens, all working now.

Excellent, glad to hear it!