Skip to content
This repository has been archived by the owner on Feb 14, 2019. It is now read-only.

Commit

Permalink
Fix Photon setup for recent Samsung devices
Browse files Browse the repository at this point in the history
  • Loading branch information
jensck committed Nov 27, 2018
1 parent 536c433 commit ea1d25b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.6.2
=====
* Fix Photon setup for recent Samsung devices

0.6.1
=====
* Fix to accommodate Android 9 behavior change re: WiFi networks
Expand Down
2 changes: 1 addition & 1 deletion devicesetup/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'

// This is the library version used when deploying the artifact
version = '0.6.1'
version = '0.6.2'

ext {
bintrayRepo = 'android'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,16 @@ public Network getNetworkObjectForCurrentWifiConnection() {
// "I want the Network obj for the Wi-Fi network with SSID <foo>".
// Instead, you have to infer it based on the fact that you can only
// have one connected Wi-Fi connection at a time.
// (Update: one *regular* Wi-Fi connection, anyway. See below.)

return Funcy.findFirstMatch(
Arrays.asList(connectivityManager.getAllNetworks()),
network -> {
NetworkCapabilities capabilities = connectivityManager.getNetworkCapabilities(network);
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
// Don't try using the P2P Wi-Fi interfaces on recent Samsung devices
if (capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_WIFI_P2P)) {
return false;
}
return capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
}
);
Expand Down

0 comments on commit ea1d25b

Please sign in to comment.