waleedAhmad1 / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
0 stars 0 forks source link

How to keep screen on for an apps #434

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I tried many approach for that including:-

1. android:keepScreenOn="true".
2. getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
3. adding <uses-permission android:name="android.permission.WAKE_LOCK" > on 
mainfeast.
4. android:keepScreenOn="true" in layout.xml

nothing helps me to keep the screen on.

and i also try to print the status by printing "this.getKeepScreenOn()" and its 
always print "true" but after 10 sec screen is going to off . I am using canvas 
to draw things at 40 fps. what can i do?

Original issue reported on code.google.com by rafitsab...@gmail.com on 10 Mar 2014 at 1:02

GoogleCodeExporter commented 9 years ago
are you trying to keep a live card or immersion screen (activity) on? I am able 
to keep the immersion screen on with "android:keepScreenOn="true"". If you are 
talking about a live card, I dont live card is design in such way that you 
should keep it on.

Original comment by so.jacky...@gmail.com on 10 Mar 2014 at 1:52

GoogleCodeExporter commented 9 years ago
yes, i am using live card and a thread to draw on a view. I try also 
"android:keepScreenOn="true"" in my layout xml.

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/black"
    android:keepScreenOn="true" >

    <com.examle.exampleView
        android:id="@+id/drawView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</FrameLayout>

But it wont work.
is there any way?

Original comment by rafitsab...@gmail.com on 10 Mar 2014 at 2:19

GoogleCodeExporter commented 9 years ago
As mentioned by comment #1, LiveCard's main feature is to let the device 
handles the screen timeout and being able to wakeup to this card while 
remaining in the timeline.

If you need more advanced features, such as the ability to keep the screen on, 
I would suggest using an Immersion for your integration.

Original comment by ala...@google.com on 10 Mar 2014 at 3:49