ApplicationShortcuts, is there any way to not open the app and only execute some actions such as Play/Pause? - ios

I have an audio app and I want to control play/pause with ApplicationShortcutItem directly, but I don't want to open the app.
Is it possible?

It is not possible to leave an app in the background when choosing a Home screen quick action.
From the documentation of UIApplicationShortcutItem:
When a user chooses one of your Home screen quick actions, the system launches or resumes your app and UIKit calls the application(_:performActionFor:completionHandler:) method in your app delegate.

Related

CallKit: Launch app when screen is locked

I have implemented callkit to receive the VoIP notification.
On accept the call I am managing calls through another third party ForzenMountain which has my custom screen to show the status of calls.
1) When screen is not locked: Call comes then it shows two button. On accept it goes into the app itself and I can manage all.
Problem:
2) When screen is locked: It show another transition which has multiple option like (speaker/keypad/mute/addcall) rather than to go into app.
I need to land on my app even my device is locked (if passcode enable then ask to enter it) so that I can manage FM and my custom calls screen.
Unfortunately, there's no way to go directly into your app if the phone is locked. The system will only display the native CallKit UI and from there you can tap on the bottom right button to go into your app.

Swift Xcode - how to differentiate between going to lock screen and going to home screen?

When the app enters the background or WillResignActive, both functions are called in my SceneDelegate. How am I able to distinguish between when the user exits the app to the HomeScreen versus just locking their phone?
EDIT: I want to perform a different function in each scenario

Create home screen quick actions that do not open app?

I have home screen quick actions for my iOS 9 app, but I don't need it to open the app. It actually schedule reminders and that's it. Is there a way to make the home screen quick action not to open the app?
Quick actions are designed to be used to quickly navigate to a section of your app, eg on the camera app there is selfie mode, box mode, panorama mode, timelapse mode etc. These are all sections of the app. To the best of my knowledge you cant have a quick action that just runs code without opening the app. Otherwise how will the user know that the code has worked and it has been executed?
This functionality would be cool but i believe it is impossible as of current. The closest you can get is make it so it opens the app to a ViewController that just says "Reminder Scheduled".

Detect Home button long press event in background

How can I detect Home button long press like 4 second or more event in my app which is already running in background? Is it possible to so because app is already running in background and if user long press home button of the device for 4 second or more can i detect the event in my background running app and if possible than will Apple approve this for app store?
No that is not possible. As you should know, a long press on the home button brings up Siri. Your app would interfere with that. Also, I don't believe Apple allows access to the home button event like that.
Lastly; while your app is in the background, it goes into a suspend state after a short while and no events run. The only thing the app can do is receive push notifications - unless you have been given special access to audio / gps functions from Apple themselves.
Short answer : Not possible. not at least with public method and want your app to be on Appstore.
For the Research purpose, you might want to try use private method and do your R&D with it. it might be possible.

Detect if home button is pressed while the app is running in the background

I need a way for my app to know if the home button is pressed, while the app is running in the background. If the home button is pressed, something is gonna be added to a list inside the app. Is that possible somehow?
If your app is in the background, your app wont receive any updates. Furthermore, there isn't any way to hook into the home button click even if your app is in the foreground.
Perhaps there is a private api way to handle this, but your app certainly won't be able to both achieve this goal and be in the Apple App Store. Sorry!
In case you wanted some idea why Apple doesn't allow this, it's because they don't want the home button switch's default behavior to be altered. See this:
10.5 Apps that alter the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, will be rejected

Resources