سؤال

Is it possible to notify an app (inactive OR active but in background) when screen is locked / unlocked?

Something like: https://stackoverflow.com/a/3617552/1011125

هل كانت مفيدة؟

المحلول

When the screen is locked, your app gets these delegate messages:

  • applicationWillResignActive:

  • applicationDidEnterBackground:

However, you cannot distinguish this situation from any other situation in which you might get those messages (e.g., the user clicked the Home button to suspend your app).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top