Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Pressing power button kills app

Discussion in 'Android' started by Mark-Ripley, Oct 20, 2011.

  1. Mark-Ripley

    Mark-Ripley

    Joined:
    Aug 22, 2007
    Posts:
    148
    Hi,

    Got a bizarre problem, whereby when the device goes to sleep or the user presses the power button, the OS forcibly kills the app.

    Here's a logcat exerpt:

    Code (csharp):
    1.  
    2. D/PhoneWindow( 2447): couldn't save which view has focus because the focused view com.unity3d.player.UnityPlayer$13@460dcba8 has no id.
    3. D/HtcLockScreen(   96): onScreenRestart
    4. I/HtcLockScreen(   96): updateStatusViewByPriority, mIsSimCheckView = true, mIsBatteryInfo = false, mIsMusicPlaying = false, mIsAirPlaneMode = false
    5. I/HtcLockScreen(   96): HtcLockScreen:onResume
    6. D/StatusBar(   96): DISABLE_EXPAND: yes
    7. D/SurfaceFlinger(   96): Layer::setBuffers(this=0x72f808), pid=96, w=480, h=762
    8. D/SurfaceFlinger(   96): Layer::setBuffers(this=0x72f808), pid=96, w=480, h=762
    9. I/WindowManager(   96): Setting rotation to 0, animFlags=1
    10. I/ActivityManager(   96): Config changed: { scale=1.0 imsi=0/0 loc=en_GB touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=72}
    11. I/HtcLockScreen(   96): onOrientationChange: inPortrait=false, mCreatedInPortrait=false
    12. D/WifiService(   96): acquireWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder@462b3970}
    13. D/LocationManager(  293): removeUpdates: listener = com.htc.htclocationservice.HtcLocationServiceAgent$7@460e5578
    14. I/HtcLockScreen(   96): onOrientationChange: inPortrait=true, mCreatedInPortrait=true
    15. D/SurfaceFlinger(   96): About to give-up screen, flinger = 0x16e7d8
    16. D/WifiService(   96): enable and start wifi due to updateWifiState
    17. D/SurfaceFlinger(   96): Layer::requestBuffer(this=0x72f808), index=0, pid=96, w=480, h=762 success
    18. V/AlarmManager(   96): Adding Alarm{464db298 type 2 com.google.android.location} Jan 01 07:07:44 am
    19. D/ConnectivityService(   96): getMobileDataEnabled returning true
    20. I/LSState (   96): EventReceiver:android.intent.action.NOTIFICATION_UPDATE
    21. D/ConnectivityService(   96): getMobileDataEnabled returning true
    22. D/SurfaceFlinger(   96): Layer::requestBuffer(this=0x4951c0), index=1, pid=96, w=480, h=800 success
    23. W/ActivityManager(   96): Activity pause timeout for HistoryRecord{463b8798birdhd.sgn.com/com.prime31.FacebookPluginActivity}
    24. D/SurfaceFlinger(   96): Layer::requestBuffer(this=0x4951c0), index=0, pid=96, w=480, h=800 success
    25. D/SurfaceFlinger(   96): Layer::requestBuffer(this=0x4ce200), index=0, pid=96, w=480, h=394 success
    26. D/AK8973  (   72): Compass CLOSE
    27. D/AutoSetting(  293): service - stop self
    28. D/SurfaceFlinger(   96): Layer::requestBuffer(this=0x4fb4c0), index=0, pid=96, w=480, h=38 success
    29. D/ConnectivityService(   96): getMobileDataEnabled returning true
    30. D/LocationMasfClient(   96): getNetworkLocation(): Returning cache location with accuracy -1.0
    31. V/AlarmManager(   96): Adding Alarm{467ffd28 type 2 com.google.android.location} Jan 01 07:07:44 am
    32. V/AlarmManager(   96): Adding Alarm{463652e0 type 2 com.google.android.apps.maps} Dec 13 10:37:11 pm
    33. D/SurfaceFlinger(   96): Layer::requestBuffer(this=0x4ce200), index=1, pid=96, w=480, h=714 success
    34. D/WifiService(   96): ACTION_SCREEN_OFF
    35. D/WifiService(   96): setting ACTION_DEVICE_IDLE timer for 900000ms
    36. V/AlarmManager(   96): Adding Alarm{465fac50 type 0 android} Oct 19 02:48:01 pm
    37. D/SurfaceFlinger(   96): Layer::requestBuffer(this=0x4ce200), index=0, pid=96, w=480, h=714 success
    38. D/SurfaceFlinger(   96): Layer::requestBuffer(this=0x4fb4c0), index=1, pid=96, w=480, h=38 success
    39. D/Sensors (   96): close_akm, fd=153
    40. D/Unity   ( 2447): onDetachedFromWindow
    41. I/Process ( 2447): Sending signal. PID: 2447 SIG: 9
    42. D/AutoSetting(  293): service - wake lock release
    43. I/ActivityManager(   96): Process birdhd.sgn.com (pid 2447) has died.
    44. I/WindowManager(   96): WIN DEATH: Window{46293920 birdhd.sgn.com/com.prime31.FacebookPluginActivitypaused=false}
    45.  
    I've already been in touch with Mike at Prime31, and he assures me it's nothing to do with the Facebook plugin.

    Does anyone have any clues? I'm completely stumped :(
     
  2. benni05

    benni05

    Joined:
    Mar 17, 2011
    Posts:
    58
    Try to set in the Android Manifest for your Activity:

    Code (csharp):
    1. android:configChanges="orientation"
    This is how I fixed a similar issue.

    Ben