-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
[Android] Listen to default network changes #23059
Conversation
c04e204
to
43c3356
Compare
43c3356
to
98f0aef
Compare
4922a89
to
85cd338
Compare
85cd338
to
0c3231b
Compare
xbmc/platform/android/activity/JNIXBMCConnectivityManagerNetworkCallback.cpp
Outdated
Show resolved
Hide resolved
xbmc/platform/android/activity/JNIXBMCConnectivityManagerNetworkCallback.cpp
Outdated
Show resolved
Hide resolved
0c3231b
to
597010e
Compare
{ | ||
CJNINetworkInterface intf = CJNINetworkInterface::getByName(lp.getInterfaceName()); | ||
if (intf) | ||
m_defaultInterface = new CNetworkInterfaceAndroid(n, lp, intf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a delete
to this new
. Maybe use std::unique_ptr instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried, but this class is common to all platforms and copy operations are done in other parts of the code... with a delete
would be fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since m_defaultInterface is local to this class I don't see a problem. You can use .get() to return the raw pointer in functions that need CNetworkInteface*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried again as you indicated and it works, please tell me if I forgot anything, thanks
597010e
to
eaa7b8f
Compare
eaa7b8f
to
0d1b363
Compare
Good to go? |
Looks good to me |
Description
All apps in a device use a default network, which is determined by the system. The network that is set as the default can change at any time. A typical example is the device coming within range of a known Wi-Fi access point. The device disconnects from the mobile network, connects to the access point and switches the default network.
The purpose of this PR is that Kodi listens to network status changes, so that if the device changes the default network, the app will do so as well.
To receive notifications of network events, use the NetworkCallback class together with
ConnectivityManager.registerDefaultNetworkCallback(NetworkCallback)
The
CNetworkAndroid
class will always keep the reference to the default network.Depends on xbmc/libandroidjni#46
Types of change
Checklist: