0

Is there any way to disable onPause() when screen is off and disable onResume() when screen is on?

ARM
  • 363
  • 1
  • 7
  • 18
  • what does "disable" mean? – Blackbelt Jun 20 '13 at 08:10
  • Do you want to stop executing code in `onPause` methods when screen off ? If so check this http://stackoverflow.com/questions/5960924/how-to-detect-whether-screen-is-on-or-off-if-api-level-is-4 – GoodSp33d Jun 20 '13 at 08:15
  • I you mean onPause / onResume not being called ... well its part of how android apps work. No you can't avoid the Activity lifecycle to run properly. Instead you should learn how to handle it. – Guian Jun 20 '13 at 08:16
  • I do not want the activity to be set in onPause statu when screen is off – ARM Jun 20 '13 at 08:16
  • to prvent to go screen off you can use weak lock and in xml file you can set android:keepScreenOn="true" and http://developer.android.com/reference/android/os/PowerManager.WakeLock.html – CoronaPintu Jun 20 '13 at 08:20

0 Answers0