Closed Nisse43 closed 4 years ago
Thx for the comment. I will fix it.
On Thu, Aug 22, 2019, 14:31 Kevin notifications@github.com wrote:
@Smeat commented on this pull request.
In Android/ChorusRFLaptimer/app/src/main/java/app/andrey_voroshkov/chorus_laptimer/MainActivity.java https://github.com/voroshkov/Chorus-RF-Laptimer/pull/109#discussion_r316628747 :
@@ -243,8 +247,22 @@ public void handleMessage(Message msg) { startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE); break; case R.id.menuUDPConnect:
- ConnectivityManager cm = (ConnectivityManager) getSystemService( Context.CONNECTIVITY_SERVICE );
- if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ) {
- for ( Network net : cm.getAllNetworks() ) {
- NetworkInfo networkInfo = cm.getNetworkInfo( net );
- if ( networkInfo.getType() == ConnectivityManager.TYPE_WIFI ) {
- cm.bindProcessToNetwork( net );
- }
- break;
The break should be inside the if statement, otherwise only the first network is evaluated, which might be the mobile network. With that change it works perfectly for me!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/voroshkov/Chorus-RF-Laptimer/pull/109?email_source=notifications&email_token=AAD3IBLHUKVYTCSQJETNDETQFZ2I3A5CNFSM4IKCQ5E2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCCLVZNY#pullrequestreview-278355127, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD3IBJZVJELXYBZAK5KDATQFZ2I3ANCNFSM4IKCQ5EQ .
Fixed the issue above and extracted a method to make the code a bit easier to understand
@voroshkov Do you want me to change anything still or expand the prefering of WIFI to TCP also?
@Nisse43, oops, sorry, lost a sense of time after the flying season. Will take a look at PRs soon. Thanks for reminding!
This works for android M 26 and above
This fixes issue #81