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

Interrupt test when connectivity changed #1296

Closed
lorenzoPrimi opened this issue Nov 25, 2020 · 2 comments · Fixed by ooni/probe-android#401 or ooni/probe-ios#413
Closed

Interrupt test when connectivity changed #1296

lorenzoPrimi opened this issue Nov 25, 2020 · 2 comments · Fixed by ooni/probe-android#401 or ooni/probe-ios#413
Assignees
Labels
ooni/probe-mobile issues related to OONI Probe mobile

Comments

@lorenzoPrimi
Copy link

When the connectivity state changed we should send an interrupt signal to the current running test.

@lorenzoPrimi lorenzoPrimi added the ooni/probe-mobile issues related to OONI Probe mobile label Nov 25, 2020
@lorenzoPrimi lorenzoPrimi self-assigned this Nov 25, 2020
@lorenzoPrimi
Copy link
Author

lorenzoPrimi commented Dec 9, 2020

iOS: we can use the current connectivity class.

Android: In andoid 7 they deprecated the BroadcastReceiver but using another JobScheduler is not a solution
https://stackoverflow.com/questions/48527171/detect-connectivity-change-in-android-7-and-above-when-app-is-killed-in-backgrou

in API 28 CONNECTIVITY_ACTION was deprecated as well
https://developer.android.com/reference/android/net/ConnectivityManager#CONNECTIVITY_ACTION

so I need to look into these two:
https://developer.android.com/reference/android/net/ConnectivityManager#registerNetworkCallback(android.net.NetworkRequest,%20android.app.PendingIntent)
https://developer.android.com/reference/android/net/ConnectivityManager#registerDefaultNetworkCallback(android.net.ConnectivityManager.NetworkCallback)

registerNetworkCallback() was added in API level 21 (Android 5.0, Lollipop). It allows you to listen for changes in networks which satisfy a certain transport type (WiFi, cellular, Bluetooth, ...) and capability (SMS, NOT_METERED, ...).

registerDefaultNetworkCallback() was added in API level 24 (Android 7.0, Nougat) and uses your callback when any network change occurs, regardless of transport type and capability.

https://stackoverflow.com/questions/53863034/difference-between-registerdefaultnetworkcallback-and-registernetworkcallback#:~:text=registerNetworkCallback()%20was%20added%20in,(Android%205.0%2C%20Lollipop).&text=registerDefaultNetworkCallback()%20was%20added%20in,of%20transport%20type%20and%20capability.

@lorenzoPrimi
Copy link
Author

iOS started with improving the current interrupts : ooni/probe-ios#412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ooni/probe-mobile issues related to OONI Probe mobile
Projects
None yet
1 participant