9

Is it possible to detect if Daydream is on or off? If so, how?

Edit: To clarify, I looking to read the system setting for DayDream (much like you can for airplane mode and other settings). You can infer that from Intent.ACTION_DREAMING_STARTED and Intent.ACTION_DREAMING_STOPPED, but it's not the same thing.

christoff
  • 587
  • 1
  • 6
  • 17

3 Answers3

5

This answer says you can use:

Intent.ACTION_DREAMING_STARTED and Intent.ACTION_DREAMING_STOPPED

for broadcast events.

Here is documentation

Community
  • 1
  • 1
Adam Johns
  • 35,397
  • 25
  • 123
  • 176
  • 3
    I saw that answer. I'm looking to read the system setting, not listen for the intent receiver. I edited my response to reflect this. – christoff Aug 14 '13 at 20:11
2

I've written a little utility class to get some Daydream settings:

  • Get if Daydream is enabled in the settings
  • Get which Daydream is selected in settings
  • (get if Daydream is possible on this device)

You can find it here: https://github.com/PieterAelse/blendle/blob/master/mobile/src/main/java/com/piotapps/blendle/utils/DayDreamUtils.java

Hope this helps you out.

PieterAelse
  • 3,578
  • 2
  • 23
  • 33
0

If you dont want to listen to the broadcasts, may be you can check the dumpsys of the dream service:

From the code, if the current dream is null (which is the case if the daydream is stopped), it will dump

"Dreamland:
  mCurrentDream: null"

You can check against this value and detect if daydream is on.

psykid
  • 418
  • 5
  • 15