I'm building a iPhone application which depends data from an online database.
To update the data in the app i could check at a certain time interval if an update is necessary but it is way cooler if i could use a push services which sends a notification to the app letting it know it is time for an update.
i'm not talking visible push notifications here, just a invisible push notification to fire the update method in my app.
Is there a standard way to do this or could i use apple's push notification services for this purpose ?
With other words: i'm now using pull to get updates, is there a push way to let the backend of my app know it is time for an update?
Edit: And if it is impossible, what would be good time interval for the update (0.03 kb if there are no updates). Is it to much to check it every 30 seconds ?
You send a push campaign to a user. 12 hours later, Iterable sends a "ghost push" (not visible or audible) to that same user. If the app has been uninstalled and the ghost push cannot be delivered, Iterable tracks an uninstall.
Silent push notifications are simply notifications that mobile app users receive without any pings, alerts, or interruptions to the user. They arrive on the mobile device and sit in the notification tray until read or dismissed.
An iOS push notification is a message that pops up on an Apple device such as an iPhone. Before receiving push notifications from an app, iOS device users must explicitly give permission. Once a user opts-in, mobile app publishers can send push notifications to the users' mobile devices.
With iOS 16, Apple will bring support for opt-in web notification support later in 2023, allowing users to receive notifications from websites through Safari and, presumably, other supported browsers on iOS. Apple mentions the feature on the iOS 16 features page, saying it will be coming to iOS in 2023.
There is a well explained documentation in the Apple Online Library.
With Apple Push Notification Service (APNS) you can get ANY combination of:
When I say any I mean that no alert, no badge and no sound are also possible. Remote notifications are available even if the application is closed (but at least once executed, for register into the notification service), iOS has the debt of manage the push and wake up your application.
If you want to use APNS you need
Everything related with CSR and trusting your server is detailed in the iOS provisioning portal, "App ID" section, "How to" tab. Try this link.
In your web server must be hosted the APNS provider who will do these two actions:
Register a token identifying a concrete installation on a concrete iOS device. This token is generated for the Apple APNS and will be sended to the Provider by your app.
Generate push notifications: Will be sended from your provider to Apple APNS, an Apple APNS will delivery to your app (with an alert and/or badge and/or sound and/or silence mode)
The APNS notification will be delivered to your app using the Remote Notification System.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
You can look into the Easy APNS App Delegate
As a provider you can use your own developed or you can use/modify anyone already downloadable like
So the answer is YES, it is possible. Using Easy APNS esamples, the push generation must look like this:
$apns->newMessage(1);
$apns->addMessageCustom('acme2', array('bang', 'whiz'));
$apns->queueMessage();
Yes, it is possible with iOS 7+
You can receive "background" push notifications if you override this method of UIApplicationDelegate: application(_:didReceiveRemoteNotification:fetchCompletionHandler:)
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void)
{
// do what you need i.e. download fresh content (max. 30 seconds)
completionHandler(UIBackgroundFetchResult.NoData)
}
As documentation of this method method says:
Use this method to process incoming remote notifications for your app. Unlike the application:didReceiveRemoteNotification: method, which is called only when your app is running in the foreground, the system calls this method when your app is running in the foreground or background. In addition, if you enabled the remote notifications background mode, the system launches your app (or wakes it from the suspended state) and puts it in the background state when a remote notification arrives.
Don't forget to enable "Background fetch" and "Remote notifications" in your background modes.
More info about background execution here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With