Switching between foreground and background

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Switching between foreground and background

beinan li
My app (not my own code) works like this:
Entering the app shows a main menu with sub-menus. 
Each submenu has its own actions such as playing audio clips.

Now, say if I was in my submenu, whenever I switch the app to background 
by using system home button or app switcher and then switch back,
I'm always brought back to my main menu with no sound when the expected behavior is 
to resume where I was and the audio playback is supposed to resume too.
It's as if the app restarted.

Here is the logcat between switching to background and back:

I/ActivityManager( 1351): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher} from pid 1351
D/dalvikvm( 1430): GC_CONCURRENT freed 606K, 74% free 8027K/30535K, paused 3ms+4ms
V/threaded_app( 3193): SaveInstanceState: 0x1ca5950
V/threaded_app( 3193): APP_CMD_SAVE_STATE
V/threaded_app( 3193): Pause: 0x1ca5950
V/threaded_app( 3193): activityState=13
I/InputReader( 1351): Reconfiguring input devices.  changes=0x00000004
W/InputReader( 1351):   Touch device 'odroidx-ts' did not report support for X or Y axis!  The device will be inoperable.
I/ActivityManager( 1351): Config changed: {1.15 0mcc0mnc en_US layoutdir=0 sw768dp w1360dp h720dp xlrg long land finger qwerty/v/v -nav/h s.16}
D/OpenGLRenderer( 1527): Flushing caches (mode 0)
I/StatusBar.HeightReceiver( 1430): Resizing status bar plugged=false height=48 old=48
V/threaded_app( 3193): WindowFocusChanged: 0x1ca5950 -- 0
V/threaded_app( 3193): NativeWindowDestroyed: 0x1ca5950 -- 0x1d29518
E/SurfaceTexture( 1256): [com.mycompany.myproject/android.app.NativeActivity] queueBuffer: SurfaceTexture has been abandoned!
E/SurfaceTextureClient( 3193): queueBuffer: error queuing buffer to SurfaceTexture, -19
E/SurfaceTextureClient( 3193): queueBuffer (handle=0x1d0a3d0) failed (No such device)
V/threaded_app( 3193): APP_CMD_TERM_WINDOW
V/threaded_app( 3193): APP_CMD_TERM_WINDOW
W/IInputConnectionWrapper( 3193): showStatusIcon on inactive InputConnection
V/threaded_app( 3193): Stop: 0x1ca5950
V/threaded_app( 3193): activityState=14
D/dalvikvm( 1351): GC_EXPLICIT freed 374K, 16% free 9536K/11271K, paused 1ms+3ms
D/AudioHardware( 1259): AudioHardware pcm playback is going to standby.
D/AudioHardware( 1259): closePcmOut_l() mPcmOpenCnt: 1
W/ThrottleService( 1351): unable to find stats for iface rmnet0

The NativeWindowDestroyed looks very suspicious....

Any tips are appreciated.

You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/rZCXpnOfuIYJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.