Azhar Ali Azhar Ali - 1 year ago 233
iOS Question

Xamarin iOS/Android: Detect Lockscreen /home screen click detection or swipe detection

I am working on a mobile app using xamarin forms, is it possible to detect swipe gesture in android for screenshot or click of lock screen or home screen ?

If it is possible via objective C/swift/java then it would also be possible through Xamarin.

Answer Source


I do not believe you can setup a swipe gesture / click during the Lock Screen as it's a separate Activity in a different process(System app). You also can't replace the lock screen with a user application.

You can control some of this via the Device Admin API:

However that's only for the opposite of what you want(Probably to know if the user finished the lock screen).

You can instead listen for the ACTION_USER_PRESENT or the fairly new ACTION_USER_UNLOCKED broadcast via a Broadcast Receiver: (API 3) (API 24)


You can use Darwin Notifications -

You can check the following events:

  • - When the screen goes blank (One of a few times it will)
  • - What state the lock is in(locked/unlocked)
  • - The device locked

Is there a away to detect the event when iOS device goes to sleep mode (when the screen gets blackened)?

Lock Unlock events iphone

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download