-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Doze mode #115
Comments
Thanks for reporting this issue! I'll take a look on that. Moreover, PR with this improvement is also welcome. I think, this functionality should be configurable and disabled by default as this project is a library. |
Okay, I will take a look into it. Should I create a new NetworkObservingStrategy like for M and above? |
I think, in this case, there is no need for additional strategy. Strategies are for different Android versions because, in different OS versions, network monitoring should be implemented in a different way. There should be a new library setting. I think, there should be a new method like: Observable<Connectivity> observeNetworkConnectivity(Context context, boolean isActiveInDozeMode) and Observable<Connectivity> observeNetworkConnectivity(Context context, NetworkObservingStrategy strategy, boolean isActiveInDozeMode) The first method should use the second one. If the user would like to, he or she can activate or explicitly deactivate network monitoring in doze mode. Moreover, I see |
I think we have a misunderstanding. |
Now, I understand your point better. Is it possible to trigger connectivity change in idle mode? |
I googled more about this issue. I'm not sure if it's possible to trigger network change in a doze (idle) mode and it may be an Android bug or intended behavior. I've found the following thread on StackOverflow: http://stackoverflow.com/a/34380449/1150795. |
What's wrong with it? We can't make a network call in Doze mode, so we can report that we are offline no matter what ConnectivityManager says. |
That sounds more reasonable if we know for sure that network call cannot be done in Doze mode. In such case, the additional broadcast receiver makes sense. Nevertheless, I would create an additional setting for that in the case someone doesn't care about Doze mode. Such feature would be useful for apps using background services and should be configurable. |
@pwittchen so it seems there is another one broadcast being sent about light idle mode |
Hi,
It should be already fixed for the latest Android version.
Regards
03.11.2017 10:53 PM "Alexander Perfilyev" <[email protected]>
napisał(a):
… @pwittchen <https://github.com/pwittchen> so it seems there is another
one broadcast being sent about light idle mode android.os.PowerManager#
ACTION_LIGHT_DEVICE_IDLE_MODE_CHANGED. Can I submit a PR to fix this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#115 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAqcF0kSP9ZVTQfswLX9H4wH7wZvtnFCks5sy4svgaJpZM4Kf-h6>
.
|
@pwittchen As I see in the source, it listens only for |
This is still not working properly. Simple test:
CODE:
LOG RESULT: |
Thanks for reporting this. I'll have a look on that. I'm also open for PRs related with this issue. |
We are also experiencing the same problem. There is also a related issue on the google bug tracker (see here). Maybe this problem can be fixed by solving #318 |
@juliankotrba Not really. |
@neteinstein thanks for your answer. Have you made a custom implementation or did you switch to an alternative library? |
@juliankotrba Custom implementation. If you're looking for an alternative: Merlin lib from novoda seems to work with Doze. |
Right now it doesn't take doze mode into account. You could add a receiver with a https://developer.android.com/reference/android/os/PowerManager.html#ACTION_DEVICE_IDLE_MODE_CHANGED intent filter. And check doze status via PowerManager.isDeviceIdleMode() method.
The text was updated successfully, but these errors were encountered: