how do i detect tap gestures when the phone is locked [duplicate] - ios

This question already has an answer here:
iPhone detect touch when screen is locked
(1 answer)
Closed 10 years ago.
The default alarm application by apple shows me a snooze button even when the phone is in lock screen and i can press it,so instead of a small button i want to create a larger button or something that will detect a multi touch when a alarm rings,is it possible? can the default lock screen be customized? thanks

As far as I know, the only thing you can get in the lock screen is a push or local notification. This has the default functionality of displaying your app's icon next to some text. You can then slide the icon to launch the app with any extra data you attached to the notification when you created

Related

iOS 10 local notifications: show notification content on lock screen

I've added local notification with Notification Content Extension.
It shows okay on home screen (with app in background).
The problem lies in displaying notification content on lock screen. When notification arrives on lock screen, it is only displayed with text and swiping left shows "Clear" button.
I need some way to show notification fully from lock screen (as on home screen).
For example I saw "View" button in some of the tutorials/articles, can I even create or control something like it?
So with notifications on iOS 10, Apple changed the way they appear on devices. When the screen is locked, you can see a View and Clear button or just clear button based on whether the device is enabled with 3D touch or not.
Swiping left on a message now offers View and Clear on non-3D Touch devices or just Clear on 3D Touch devices.
On 3D Touch devices, the long press on notification reveals the notification actions menu which can be customized using Category definition in the code.
Hope this answers your query.

How do I remove a badge notification from my app after clearing it rather then launching the app [duplicate]

This question already has answers here:
How to detect when user clears your app's notification
(2 answers)
Closed 6 years ago.
I have an app that will show a notification icon when the user has not been to the app in awhile I can get it to clear when I launch the app but I want it to clear when they swipe clear from their phone notifications. The code I use to clear when I open the app is
UIApplication.shared.applicationIconBadgeNumber = 0
I just started using swift today to help a coworker on their project. If anyone could point me in right direction at least would be appreciated.
Sorry but you can't "launch code" from your application if your app is not opened. Maybe you could use a shortcut with 3D Touch "Clear" or something more user friendly that would clear the notification badge without launching the app.
You can take a look at the officiel documentation here .

Can an active iOS app know when a push notification is being displayed for a different app? [duplicate]

This question already has answers here:
How to detect push notification sent to other apps?
(2 answers)
Closed 6 years ago.
I'm working on an iOS game that has a score counter and some buttons at the top of the screen. When I receive any push notifications for a different app (e.g. a new email), the push notification covers the top of the screen for a few seconds, which is annoying when you're in the middle of a game. I would like to know whenever a third-party notification is being displayed, so that I can move the score counter and buttons below the push notification while it is being shown.
Is this possible?
Unfortunately, as of now (and probably forever) there is no API or way to interact with Apple's Notification Center, and thus it's impossible to know when a third-party notification is displaying. This is primarily because they strive to keep a consistent user experience across their entire platform at the developer's expense. The closest you can get is knowing when an application has left and entered the foreground (which will happen when they tap that notification) to properly pause the game
Thankfully, users can dismiss the alerts really quickly with a swipe of a thumb, but regardless, it's still annoying. Maybe make some small adjustments to your UI with this knowledge and have less user taps necessary at the top of the screen?
Good luck!

Button accesible from lock screen in iOS

I want to develop an iOS app that can have like a panic button when the screen is locked. This button can be enable or disabled within the app, but
I want to know if it is possible to add a very accessible button you can press in case of an emergency even when the screen is locked. When the button is pressed I want to execute some code in the app.
Is there a possible way of accomplishing this in iOS?
Or is there an alternative?, The only think that I required is that the button can be pressed like in maximum three seconds even if the screen is locked and the app closed.
No that is not possible in iOS. You cannot make changes outside of your app.
One suggestion i can give you is to make a extension for today view in notification center. And you can ask the users to touch the button in notification center to invoke your functionality.
Notification center can be accessed in lock screen also.

Hide/Minimize app on button tap [duplicate]

This question already has an answer here:
How to minimize an ios app [duplicate]
(1 answer)
Closed 8 years ago.
In my app I want to minimize/hide my app when user presses an button. It it possible to hide or minimize app on UIButton tap? If so, how?
No, that's not possible. You can put all kinds of functionality on UIButton clicks, but returning to the home screen is not a functionality that is available. Going back to the home screen after an action within the app could be interpreted as a crash.
This is what the home button is there for after all.

Resources