[mono-android] Turning display on and off

Goncalo Oliveira goncalo at minkan.net
Thu Dec 13 11:53:07 UTC 2012


Well, that seems to be an undocumented flag... it's value seems to be 32,
you can try a force cast.
Check
http://code.google.com/p/speakerproximity/source/browse/trunk/src/net/androcom/dev/speakerproximity/MyPhoneStateListener.javaline
53.

like
wakeLock = pm.NewWakeLock( (WakeLockFlags)32, "your_tag_here" );

If that flag is correct it should work.


On 13 December 2012 10:45, Stephan Steiner <stephan.steiner at gmail.com>wrote:

> The issue with that is that it requires special permissions my app doesn't
> have. I'm not really looking to put the device to sleep, I merely want to
> turn off the screen.
>
> I found this:
>
> http://stackoverflow.com/questions/3018716/android-turn-off-screen-when-close-to-face
>
> so I guess I need a way to get a new wake lock with the value of
> PROXIMITY_SCREEN_OFF_WAKE_LOCK but that value isn't available in M4A. And
> the SpeakerProximity project is GPL'ed, and I don't suppose using java
> interop (which I'd like to avoid at this juncture) would be considered
> different from using the lib in a java project (so basically a nogo).
>
> >
> >gap: "Turning screen off, haven't tried in mono for android, but in java
> this works"
> >
> >powerService.goToSleep( SystemClock.uptimeMillis() + 1 );
>
>
>
>
>
> --
> View this message in context:
> http://mono-for-android.1047100.n5.nabble.com/Turning-display-on-and-off-tp5712611p5712616.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>



-- 
Gonçalo Oliveira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20121213/2678fc7f/attachment.html>


More information about the Monodroid mailing list