I want to get all the system notifications in my app and want to scheduling them. Is it possible in iOS ? Example - Suppose my mail app is on. When a email arrives, a notification appears there. I want to catch that notification in my app for scheduling either in foreground or background. How can i do it ? Please help. Thanks.
This is not possible. In iOS notifications are "owned" by an app. There is no way you can read the other apps notifications.
Moreover, as you probably know, iOS gives the user the ability to limit the types of notifications your app displays.
Related
Is there any way to receive all local/remote notifications iOS device gets from inside my app.
I know that this is a security matter and probably there is no way to do that. But I want to be sure.
Thanks in advance!
NO
You can't get any handler or callback after receiving notifications for another apps. iOS will not allow you to do same. You can just receive and handle notifications for your app only.
While you can do this in android as android OS allows you to listen actions and events occurred in other apps as well.
I am trying to make an app where you could send a warning to other users which then will trigger an alarm on the receivers phone.
So my plan is to send a silent warning to the receiver, which then triggers sounds and vibrations on the receivers phone from the app.
So basically my question is, is it possible to open an app on a phone through a silent push?
This is done with push notifications in iOS. See Apple's description.
Apps must be configured appropriately before they can receive local or remote notifications. The configuration process differs slightly on iOS and OS X, but the basic principles are the same. At launch time, your app registers to receive notifications and works with the system to configure that notification support. Once registration is complete, you can start creating notifications for delivery to your app. Your app then handles these incoming notifications and provides an appropriate response.
But note that it is up to the receiving user to determine how he wants to be alerted.
I see this in the Apple Watch Programming Guide:
When one of your app’s local or remote notifications arrives on the
user’s iPhone, iOS decides whether to display that notification on the
iPhone or on the Apple Watch.
Is there a way to make a notification only appear on the watch?
This was not possible until watchOS 3.
watchOS 3 introduces the User Notifications framework, which supports the delivery and handling of local and remote notifications. You can use the classes of this framework to schedule the delivery of local notifications based on specific conditions, such as a date or time or after a time interval, and to receive and handle local and remote notifications when they are delivered to the user’s device.
You can now schedule a local notification on the watch, and the notification is (delivered to and) only handled by the watch. It will not appear on the phone.
For more information, see the WWDC 2016 Introduction to Notifications, and Quick Interaction Techniques for watchOS sessions.
Useful picture from this guide:
Unfortunately no, with watch apps you now need to handle notifications in 3 places. When the app is running, application:didReceiveLocalNotification: is called. When the phone is unlocked the notification is sent to the notification center and you'll need to handle the user selecting it in application:didFinishLaunchingWithOptions:. The watch will automatically handle any notification its containing app gets, displaying the app and the alert's body. If you want a custom notification you'll need to setup a notification category in the containing app and a dynamic notification in the watch. If you're trying to just get information from the app to the watch you can use the app groups dictionary or the openParentApplication:reply: method.
Nope. It's completely controlled by the OS.
Whatever you can do on the watch app, you can check it from this relatively simple documentation:https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/
And I don't think you can do something like what you say. We have to admit that there are a lots limitations in this version of WatchKit.
How would you send a notification to the lock screen of an iPhone from an app when something occurs?
That kind of notification is known as a push notification (different from NSNotification). Here's a tutorial on how to get up and running with Apple Push Notifications (APNs). There are also tools out there to streamline the process, such as Parse.com and Push.io, though I cannot speak to the quality of either of those products.
Is it possible to wake up a background application with a non ios notification center? e.g. if I were creating a calling or messaging application is it possible to wake the application via SMS.
Nope. If you want to call app outside the device, you should use APNS. On the device you can use local notification. Sending SMS to wake up app is kinda wrong. People don't like such solutions - imagine bunch of SMS every day for different apps. Sorry.
No.
If you have background code running, you can schedule a local notification to yourself. If the user clicks "Ok" then you will come to the foreground. See here for a description and sample code.
As far as I can tell, the only ways to launch an app without user input is via a custom URL handler or via an accessory. It doesn't sound like an accessory fits your use case. Sadly you can't open URLs from the background, so you can't use this to wake yourself.