Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google pixel wifi change event is received in 30 sec delay #460

Open
seladev opened this issue Apr 21, 2021 · 5 comments
Open

Google pixel wifi change event is received in 30 sec delay #460

seladev opened this issue Apr 21, 2021 · 5 comments

Comments

@seladev
Copy link

seladev commented Apr 21, 2021

Describe the bug
I am using this code for listening to wifi changes -
ReactiveNetwork.observeNetworkConnectivity(context)
.subscribeOn(Schedulers.io())
.filter(ConnectivityPredicate.hasType(NetworkCapabilities.TRANSPORT_WIFI))
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
logWarning("###### change network = $it")
},{ })

I am testing the code in different devices and its work,
but in Google pixel 3a i am receiving the wifi concavity change event in 30 seconds delay.
In Samsung device i am receiving the wifi concavity change event immediately

To Reproduce
Steps to reproduce the behavior:

  1. Turn Off Wifi
  2. Open activity \ fragment that with the specific code
  3. Turn On Wifi in the device
  4. observe subscribe in observeNetworkConnectivity
  5. observe Wifi connection in the Device
  6. See when the Wifi connection success and when observeNetworkConnectivity subscribe received
  7. Wifi connect event received after 30 seconds from the device Wifi connection

Expected behavior
The Wifi connect in the same time

Smartphone (please complete the following information):

  • Device: Google Pixel 3a
  • OS: Android 11
  • Library Version: 3.0.1
@pwittchen
Copy link
Owner

pwittchen commented Apr 21, 2021

Thanks for reporting this.

If you observe different behavior on two different devices with the same code where the only difference is delay, then this is clearly hardware issue and library cannot do anything about this. It can be also Android OS issue, but still it's not related to the library.

Regards,
Piotr

@seladev
Copy link
Author

seladev commented Apr 21, 2021

Thanks for your quick answer

When i am listening to wifi changes with BroadcastReceiver i can see that the wifi connection event immediately.
This is the BroadcastReceiver:
receiver = new NetworkChangeReceiver(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); registerReceiver(receiver, intentFilter); receiver.setConnectionListener(this);

This is the logs:
2021-04-21 11:37:21.943----- NetworkChangeReceiver ###### change network wifi enable = false --------------------
2021-04-21 11:37:49.358----- NetworkChangeReceiver ###### change network onReceive = android.net.conn.CONNECTIVITY_CHANGE --------------------
2021-04-21 11:37:49.363----- NetworkChangeReceiver ###### change network wifi enable = true --------------------
2021-04-21 11:37:49.370----- NetworkChangeReceiver ###### change network onReceive = android.net.conn.CONNECTIVITY_CHANGE --------------------
2021-04-21 11:37:49.404----- NetworkChangeReceiver ###### change network wifi enable = true --------------------
2021-04-21 11:38:19.325 Fragment -------------------- ###### change network = Connectivity{state=CONNECTED, detailedState=CONNECTED, type=1, subType=0, available=true, failover=false, roaming=false, typeName='WIFI', subTypeName='', reason='null', extraInfo=''} --------------------

@pwittchen
Copy link
Owner

pwittchen commented Apr 21, 2021

In this receiver you are not using NetworkCapabilities.TRANSPORT_WIFI. I haven't tested library with this option. When you will use filter(ConnectivityPredicate.hasType(ConnectivityManager.TYPE_WIFI)) in the library, then you will get immediate result as well.

@seladev
Copy link
Author

seladev commented Apr 21, 2021

I tried this code filter(ConnectivityPredicate.hasType(ConnectivityManager.TYPE_WIFI))
It is the same behaviour - 30 sec delay

@seladev
Copy link
Author

seladev commented Apr 21, 2021

I also tried it with no filter - and It is the same behaviour - 30 sec delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants