Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable "turn-to-sleep" on Apple Watch?

I'm working for an airline with their app. We have released the app on Apple Watch, but have a big problem: the scanners for the QR-code used to go through security and to board the plane, are scanning from the bottom and up...

This means that you cannot use the watch app, because when you turn your wrist, the watch goes in black sleep mode.

Is there any way of turning this temporarily off for a view? I have heard rumours that it can be disabled in WatchOS 4, but can't find out how.

Thanks for the help! :)

like image 975
Otziii Avatar asked Nov 07 '22 11:11

Otziii


1 Answers

This is very interesting question. There seems no way to present this without the PassKit(Or even with passkit the screen will still go off...) I think PassKit Controller has some functions when you focus the QR code it doesn't go to sleep...

reading the watchkit reference in here , you need to implement presentation of the passkitController.

Because right now you cannot tell apple watch to resign sleep, it is agains human guidelines + it would really be energy-consuming solution. Instead, apple handles for you with PassKitController instance. So on watchkit, you do this:

 let pass = PKPass(data: /*There goes your data*/, error: nil)
            presentAddPassesController(withPasses: [pass]) {
                // Do  smth on completion
            }

You definitely should try to inform user and give him access to export the pkpass to wallet...

Resources used:

https://github.com/TwoRingSoft/pkpassgenerator

For generating custom passkit object

This could help you as well:

https://www.natashatherobot.com/url-apple-wallet-passkit-pass/?utm_campaign=This%2BWeek%2Bin%2BSwift&utm_medium=email&utm_source=This_Week_in_Swift_138

like image 89
Dominik Bucher Avatar answered Nov 14 '22 23:11

Dominik Bucher