Keep Screen On & Change Orientation

by naxtek » Thu, 12 Feb 2009 00:19:10 GMT


Sponsored Links
 Hi - After some help with this.

I am making an Android app which is currently coming along nicely -
I've hit upon a couple of stumbling blocks.


1) How do I stop the screen from going dim/off and the phone locking
while the application is running?

2) Can I force the phone to enter landscape mode on running my
application?

Thanks,
Andrew :)
--~--~---------~--~----~------------~-------~--~----~



Keep Screen On & Change Orientation

by Dianne Hackborn » Thu, 12 Feb 2009 01:57:35 GMT


 There is a flag in WindowManager.LayoutParams you can set to keep the screen
on.  (Please do NOT use the lower-level PowerManager class for this.)

Use android:screenOrientation on the activity in your manifest to force a
particular orientation mode.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Crash when using setCamera on Cupcake

I'm getting the same crash every time I call mr.setCamera(mCamera) ,
where mr is a MediaRecorder and mCamera is a Camera object. Is there
any way in particular I need to use the setCamera() method? I know
there's some hacky stuff with Camera locks, but I'm building for
Cupcake and there is no api for locking or unlocking a Camera object.

Here's the crash dump...

D/Vidshare(  397): *** VideoStream *** startStreamingVideo() ***
D/CameraService(   35): Client (0x21270) E disconnect from (397)
V/QualcommCameraHardware(   35): stopPreview: E
V/QualcommCameraHardware(   35): stopPreviewInternal E
V/QualcommCameraHardware(   35): waiting for QCS_IDLE
V/QualcommCameraHardware(   35): free_preview_mem: EX NOP
V/QualcommCameraHardware(   35): free_preview_mem: EX NOP
V/QualcommCameraHardware(   35): free_preview_mem: EX NOP
V/QualcommCameraHardware(   35): free_preview_mem: EX NOP
V/QualcommCameraHardware(   35): STATE CAMERA_FUNC_STOP_PREVIEW //
STATUS 1
V/QualcommCameraHardware(   35): state transition
QCS_INTERNAL_PREVIEW_STOPPING --> QCS_IDLE
V/QualcommCameraHardware(   35): stopPreviewInternal: Freeing preview
heap.
V/QualcommCameraHardware(   35): destroying PreviewPmemPool
V/QualcommCameraHardware(   35): releasing PreviewPmemPool memory
0x41024000 from module 22
V/QualcommCameraHardware(   35): destroying MemPool preview
V/QualcommCameraHardware(   35): destroying MemPool preview completed
V/QualcommCameraHardware(   35): stopPreviewInternal: X Preview has
stopped.
V/QualcommCameraHardware(   35): stopPreview: X
V/QualcommCameraHardware(   35): cancelPicture: E cancel_shutter = 1,
cancel_raw = 1, cancel_jpeg = 1
V/QualcommCameraHardware(   35): not taking a picture (state QCS_IDLE)
V/QualcommCameraHardware(   35): cancelPicture: X
V/QualcommCameraHardware(   35): release E
V/QualcommCameraHardware(   35): stopping camera.
V/QualcommCameraHardware(   35): stopping camera: waiting for QCS_INIT
V/QualcommCameraHardware(   35): STATE CAMERA_FUNC_STOP // STATUS 1
V/QualcommCameraHardware(   35): state transition
QCS_INTERNAL_STOPPING --> QCS_INIT
V/QualcommCameraHardware(   35): Shutting REX down.
V/QualcommCameraHardware(   35): REX has shut down.
V/QualcommCameraHardware(   35): dlclose(libqcamera) refcount 0
V/QualcommCameraHardware(   35): release X
V/QualcommCameraHardware(   35): ~QualcommCameraHardware E
V/QualcommCameraHardware(   35): ~QualcommCameraHardware X
D/CameraService(   35): Client X disconnect
D/Vidshare(  397): *** VideoStream *** file created ***
D/Vidshare(  397): *** VideoStream *** Creating media recorder ***
D/CameraService(   35): Client (0x21270)  E destructor
D/CameraService(   35): Client (0x21270) E disconnect from (35)
D/CameraService(   35): Client X disconnect
D/CameraService(   35): Client X destructor
I/DEBUG   (   32): *** *** *** *** *** *** *** *** *** *** *** *** ***
*** *** ***
I/DEBUG   (   32): Build fingerprint: 'vodafone/vfpioneer/sapphire/
sapphire:1.5/CRB17/146733:user/ota-rel-keys,release-keys'
I/DEBUG   (   32): pid: 397, tid: 428  >>> com.gm375.vidshare <<<
I/DEBUG   (   32): signal 11 (SIGSEGV), fault addr 00000028
I/DEBUG   (   32):  r0 001d2c88  r1 00000007  r2 410b18e0  r3 00000028
I/DEBUG   (   32):  r4 001d2c88  r5 410b18e0  r6 00000000  r7 45973d84
I/DEBUG   (   32):  r8 45973da0  r9 4104bf04  10 4104bef0  fp 00000001
I/DEBUG   (   32):  ip a9d46ba4  sp 45973d40  lr ad046ca5  pc
ad03dcee  cpsr 00000030
D/dalvikvm(   63): GC freed 2173 objects / 126976 bytes in 253ms
I/DEBUG   (   32):          #00  pc 0003dcee  /system/lib/libdvm.so
I/DEBUG   (   32):          #01  pc 00046d68  /system/lib/
libandroid_runtime.so
I/DEBUG   (   32):          #02  pc 000050ce  /system/lib/
libmedia_jni.so
I/DEBUG   (   32):          #03  pc 0000e3b4  /system/lib/libdvm.so
I/DEBUG   (   32):          #04  pc 00040a8a  /system/lib/libdvm.so
I/DEBUG   (   32):          #05  pc 00013118  /system/lib/libdvm.so
I/DEBUG   (   32):          #06  pc 00017b1c  /system/lib/libdvm.so
I/DEBUG   (   32):          #07  pc 00017560  /system/lib/libdvm.so
I/DEBUG   (   32):          #08  pc 000520ec  /system/lib/libdvm.so
I/DEBUG   (   32):          #09  pc 0005210a  /system/lib/libdvm.so
I/DEBUG   (   32):          #10  pc 00047144  /system/lib/libdvm.so
I/DEBUG   (   32):          #11  pc 0000f880  /system/lib/libc.so
I/DEBUG   (   32):          #12  pc 0000f3f4  /system/lib/libc.so
I/DEBUG   (   32): stack:
I/DEBUG   (   32):     45973d00  4403402c
I/DEBUG   (   32):     45973d04  00000000
I/DEBUG   (   32):     45973d08  00000000
I/DEBUG   (   32):     45973d0c  00000000
I/DEBUG   (   32):     45973d10  00000001
I/DEBUG   (   32):     45973d14  a9d2e3bd  /system/lib/libutils.so
I/DEBUG   (   32):     45973d18  001db600  [heap]
I/DEBUG   (   32):     45973d1c  ad063aff  /system/lib/libdvm.so
I/DEBUG   (   32):     45973d20  001d2c88  [heap]
I/DEBUG   (   32):     45973d24  00000001
I/DEBUG   (   32):     45973d28  00000007
I/DEBUG   (   32):     45973d2c  ad046ca5  /system/lib/libdvm.so
I/DEBUG   (   32):     45973d30  001d2c88  [heap]
I/DEBUG   (   32):     45973d34  410b18e0
I/DEBUG   (   32):     45973d38  df002777
I/DEBUG   (   32):     45973d3c  e3a070ad
I/DEBUG   (   32): #00 45973d40  00000000
I/DEBUG   (   32):     45973d44  ad363d58
I/DEBUG   (   32):     45973d48  001db580  [heap]
I/DEBUG   (   32):     45973d4c  ad346d6b  /system/lib/
libandroid_runtime.so
I/DEBUG   (   32): #01 45973d50  ad368d80
I/DEBUG   (   32):     45973d54  00000000
I/DEBUG   (   32):     45973d58  001db6d8  [heap]
I/DEBUG   (   32):     45973d5c  45973dc0
I/DEBUG   (   32):     45973d60  00000000
I/DEBUG   (   32):     45973d64  001db580  [heap]
I/DEBUG   (   32):     45973d68  43203720
I/DEBUG   (   32):     45973d6c  ab3050d1  /system/lib/libmedia_jni.so
I/ActivityManager(   63): Process com.gm375.vidshare (pid 397) has
died.
I/WindowManager(   63): WIN DEATH: Window{432bd410 com.gm375.vidshare/
com.gm375.vidshare.VSActivity paused=false}
I/WindowManager(   63): WIN DEATH: Window{431e7628 com.gm375.vidshare/
com.gm375.vidshare.VideoStream paused=false}
D/Zygote  (   34): Process 397 terminated by signal (11)
I/WindowManager(   63): WIN DEATH: Window{432af9b0 SurfaceView
paused=false}


Any help would be greatly appreciated.

-- 

2. voice recognition with sdk 2.1 does not work

It appears that the emulator with SDK 2.1 does not include Voice
Search. If this is the case how can I develop voice recognition
applications using the emulator. I get the error "Recognizer not
present". When using the Android Dev Phone image from HTC, it does
have Voice Search, but I get the error "Audio Problem". How can one
get voice recognition to work with SDK 2.1.

thanks,
Ravi.

-- 

3. layout on top of the InCallScreen

4. geo fix in emulator - strange pattern in gps fix timestamps

5. How to set PIN code(in SIM card) ?

6. Search Activity / Suggestion Provider affects Parent Activity Lifecycle

7. ContextMenu for WebView