Fix network broadcasts on Android 7.0 (fixes #783) (#918)

This commit is contained in:
Unrud 2017-07-17 05:24:53 +02:00 committed by Felix Ableitner
parent b09abf320e
commit a3deb81c72
1 changed files with 2 additions and 2 deletions

View File

@ -319,7 +319,7 @@ public class SyncthingService extends Service implements
// Android 7 ignores network receiver that was set in manifest
// https://github.com/syncthing/syncthing-android/issues/783
// https://developer.android.com/about/versions/nougat/android-7.0-changes.html#bg-opt
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
registerReceiver(mNetworkReceiver,
new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
@ -414,7 +414,7 @@ public class SyncthingService extends Service implements
sp.unregisterOnSharedPreferenceChangeListener(this);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB)
unregisterReceiver(mPowerSaveModeChangedReceiver);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
unregisterReceiver(mNetworkReceiver);
}