luisba313
Android Fan
Profile
Posts: 201
Reg: Jul 11, 2011
Spain
3,810
08/16/12 04:27 AM (13 years ago)

When surfing in the navigator app, the phone sleeps..

When surfing in the navigator app, the phone sleeps.. Hello In my app, when you clic on something and you go to the navigator of the app (internet), to watch something live streaming, if you dont touch the phone for some minutes (it depends on the phone of each one), the sleps and turn the screen into black (because its normal). SO how I do to avoid that? I know I have to write some code... I hate code lol thanks a lot
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
08/16/12 05:08 AM (13 years ago)
It MIGHT be as simple as adding a line to the screens xml file: android:keepScreenOn="true" Haven't tried it though.
 
luisba313
Android Fan
Profile
Posts: 201
Reg: Jul 11, 2011
Spain
3,810
like
08/16/12 07:49 AM (13 years ago)
thanks, im gonna try it
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
08/16/12 08:25 AM (13 years ago)
Hi, let us know if it works.
 
luisba313
Android Fan
Profile
Posts: 201
Reg: Jul 11, 2011
Spain
3,810
like
08/16/12 08:48 AM (13 years ago)
in which xml file have I to put that?
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
08/16/12 09:03 AM (13 years ago)
If you're using a customURL plugin for the streaming, it'll go in the screen_customurl xml file. Try this: <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webView" android:layout_width="fill_parent" android:keepScreenOn="true" android:layout_height="fill_parent"> </WebView> or if that doesn't work, try putting it in the linearLayout in the same file: <LinearLayout android:id="@+id/subContainer" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center_horizontal" android:keepScreenOn="true" android:orientation="vertical">
 
luisba313
Android Fan
Profile
Posts: 201
Reg: Jul 11, 2011
Spain
3,810
like
08/16/12 09:19 AM (13 years ago)
Not necessary anything of that! I just went to res>layout and opened "act_base.xml", and I only added: android:keepScreenOn="true" at the top, with all the "android" lines. I extracted the .apk, tested on my phone and the phone does not sleep! thanks man! you rock
 
luisba313
Android Fan
Profile
Posts: 201
Reg: Jul 11, 2011
Spain
3,810
like
08/16/12 09:26 AM (13 years ago)
Not necessary anything of that! I just went to res>layout and opened "act_base.xml", and I only added: android:keepScreenOn="true" at the top, with all the "android" lines. I extracted the .apk, tested on my phone and the phone does not sleep! thanks man! you rock
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
08/16/12 02:48 PM (13 years ago)
Excellent mate! I was thinking to put it in customURL so the rest of the app would act normally, but it doesn't matter. Great that it's worked!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.