We can set up a focus status with customized turning on time and turning off time. I'd like to be notified when I am in my own app. Unfortunately INShareFocusStatusIntentHandling was not called when a system notification "Focus on" came out. Anybody know some solutions or ideas about it. Thanks ahead!
According to https://developer.apple.com/forums/thread/682143 you need to implement an Intents Extension from your app and have that extension share the results to the main app via UserDefaults or some other method. You cannot observe the focus state changes directly in your app.
Related
My scenario that I need to show the first Local Notification using Swift and then using the same identifier add another Local Notification, but without showing it as a popup in iOS device. So basically the flow would be like this:
Starting upload... <-- Show on the screen and adds to the Tray bar
Uploading photos... <-- Does not shows on the screen, but clears all the notifications and add another one in Tray bar silently (or changes previous one)
Uploading data... <-- Same as Uploading photos...
Finished uploading... <-- Same as Uploading photos...
Tried different ways, on Android it is not hard to do that, but iOS makes everything hard to do, is it even possible? :)
Thanks!
The reason it works on Android is because the "state showing" notifications are very Android thing. iOS is not designed for this kind of stuff because you almost never do something in the background of an app that also needs to be reflected to the user while user is outside of an app. So the real answer to your question is no. In iOS environment it is not possible to simulate Android way of showing status changes in a notification.
I'm working on an app that will support CarPlay.It's an audio app.
I'm able to show 2 tabs (favourite and recommended) though I just don't know how to show the Now Playing Tab. I just cannot find any info regarding this.
Do I have to manually show it, and the, how do I push? Do I have to do it manually? If so, what's the viewcontroller?
Thanks.
For the Transition to the Now Playing tab to work on both the simulator and an actual car, you need to make sure to
call beginReceivingRemoteControlEvents on the current UIApplication, and
set a nowPlayingIdentifier on the MPPlayableContentManager
before calling the completion handler in playableContentManager:initiatePlaybackOfContentItemAtIndexPath:completionHandler:.
I know this post is a couple months old, but for me, I had to test in an actual device with CarPlay. Apple says always test it on an actual device with CarPlay. At first, I didn't see a Now Playing tab in the simulator, but as soon as it was tested in a device it was there automatically. I didn't do anything special. I think CarPlay knows when you're playing audio via MPNowPlayingInfoCenter and does this automatically in the actual CarPlay device.
I want to programmatically invoke my running application which is currently in background state.
I know it can be done by local notification but is there any other way, any suggestion would be helpful.
Well YES in a way. You can simply implement push notifications for your app wherein there will be a notification displayed from the top of your device . On clicking this notification, the app will open accordingly. This is done by default. I hope this is what you were asking. Otherwise, there is NO other way to get your app from the background to the foreground state without clicking the icon of the app.
No, there is not a such a way.
As far as my knowledge directly we can't change app state from background to foreground programmatically. There are no other methods available other than Notifications.
I have a state-transition problem with NSTimer, of which I find difficult to keep track of during applicationWillResignActive / applicationDidEnterBackground, according to the context of my app.
I was wondering if it might not be a better idea to utilise UILocalNotification, especially given it's background/inactive firing. However, I wanted to know whether we have the ability to provide a custom method to UILocalNotification, of which does not present a dialog box (would damage the whole point of my app). In effect, i'd like to only make use of the timer-fire capabilities of UILocalNotification, and handle the fire event with my own method which does something very "undialog-friendly"
Have checked the ADC docs and it alludes to the dialog being presented every time.
Any advice you can give on this would be appreciated.
thanks
sc.
The dialog box is presented when your app is in the background. But it is not presented when your app is running - instead your app is free to deal with the notification however it sees fit. So it would be perfectly possible to hook it up to a custom method of your own making.
The main reason for this behaviour is a user may not want to go into your app if it's in the background. Of course, with iOS 5 the notification may not be a dialog box - it could be one of the new notification styles.
I have an app which crashes everytime when I resume it.
I want that when user clicks Home button, the app should close rather than go in background mode.
Is that possible?
If yes, please let me know.
If not, what could be the workaround so that my app does not crash when I resume it?
Thanks!
In the plist, set YES to Application does not run in background key.
When ur application is in background, due to memory insufficient, the views (and the objects released in viewDidUnload) might be released. Again when reopen the application, make sure all the required objects are re-initialized.
To opt out of background execution, see this thread... But ideally what you should do is fix the crash and let app user enjoy iOS background feature..
what could be the workaround so that my app does not crash when I
resume it?
Never think of work arounds when you can handle it straight..