Can iOS notification push a file - ios

Can I somehow send a whole file with a push notification on iOS, or send a notification to a device to download a file from a server.
The device NEEDS to do that on it's OWN, without user interaction and I need it to work without updating the app in the store.
So is that possible? If not any advices/alternatives are welcome.

Can I somehow send a whole file with a push notification on iOS
While you could serialize your file and send it, push notifications are limited to 2kB.
or send a notification to a device to download a file from a server.
You can do it with "Remote notifications" background mode.
The device NEEDS to do that on it's OWN, without user interaction
The previous option will work, unless your user manually killed your app.
I need it to work without updating the app in the store.
You will need to update your app. At least to turn on "Remote notifications" background mode and handle the incoming data.
EDIT:
And don't forget that Push Notifications are NOT RELIABLE!
A Push notification can be delayed or even never distributed. That's why you should NEVER rely on it to achieve any critical work.

No, you cannot push an entire file given that a push notification is limited in size to 2KB (256 bytes in pre-iOS8). It is possible to cause an app to execute code using a push notificiation.
Depending on the type of app, it might be able to ocassionally poll your server and retrieve information. All in all, you will certainly have to make changes to your app's code, thereby requiring you to publish a new version on the App Store.

Can I somehow send a whole file with a push notification on iOS
NO
You can learn more about Push Notifications and get answers to other questions here
How we leverage iOS push notifications

Related

Server sends data while iOS app is terminated

I have an application which has communication with a remote server. The server should push data into it using remote notification silently, and I need to get and store these data into a CoreData database. The user won't be aware of the whole process.
I can successfully get notified when the app receives a remote notification, while it is either in the foreground or background mode. However, I need to get data while the app is terminated as well.
I searched for the possible solutions. For example, this SO question was good if I don't tend to use silent notification. I also saw the PushKit capability, but I am not sure about the Apple Review result.
What is the possible solution?
If I want to use VoIP and PushKit to get notified when the app is terminated, would Apple reject my application?
If you’re not creating a VoIP app and you want your app to be in the App Store then the correct answer is: it is not possible. The only thing that can be done is adjusting your requirements in some way.
For instance you can send some notifications that will be visible for user in the Notification Center and wait until the user taps the notification or starts the app the usual way. Then the app will be able to do all the operations you need.
The delivery of push notifications is not guaranteed, so you should not rely on them to synchronise data.
For example, if multiple push notifications are sent while the device is offline, only the last notification is delivered when the device comes back online; the earlier notifications are lost.
When your app launches one of the first things it should do is check with your server for new data.

Do Push Notifications with content-available work for users that have disabled Push Notifications?

I'm looking into reliable ways of updating an iOS app with content of critical importance, when instructed to do so by a server.
This would have to trigger regardless of the state of the app (foreground, background, not running, etc). Most sources seem to indicate that Push Notifications with the content-available: 1parameter are able of doing this.
My question is, what happens if the user either presses Cancel when prompted to allow the app to receive push notifications, or turns them off afterwards ? Is he only not going to receive alerts anymore, or will the push notifications be entirely ignored (including the content update) ? And if so, is there any other iOS feature that would reliably allow me to update the app's content (regardless of app state and without the user being able to disable it) ?
This is about iOS 7 and above.
If user disallows the push notifications , you can not send them the notifications forcefully.
What kind of data you want to update afterwards?
Most of the data can be changed dynamically by web services...

Notification - when app is killed

I have implemented AWS SNS push notification service.
We have an issue which is explained below :
Scenario :
We are trying to save the notification message we receive as a part of requirement.
When the app is killed (swipe out from recent apps) we are able to receive notification, also we are able to save the notification message when we open the message directly from the notification panel it works fine,but when we open the app directly the notification message is not getting saved.
In short we are not able to know if we had received a notification message if we directly open the app rather than clicking the message from the notification panel.
Is this default behavior ? or is there any work around for this ?
Have looked into many posts on about Push Notifications but haven't seen any threads pointing to this scenario.
This is a normal behavior, and there is no workaround.
If your app is killed by the user, it won't be able to run ANY code before it's manually launched again.
If it's manually launched from a notification, this notification's payload will be handled by your AppDelegate.
On top of that, don't forget that Push notifications are Best Effort. That means that they are not reliable, they can be heavily delayed or never delivered at all. Don't rely on Push notifications to achieve any critical work.
If you need to keep a copy of your notifications in-app, keep them server side and fetch them as you would do with any other object.
In order to execute code when the app is killed by the user you need to implement VOIP using PushKit framework provided by apple.
VOIP push unlike regular push notification enables the app to become active even if the app is killed by user.

Using content available push notifications to update iOS app

I am building an app that has can be used by the same user across multiple devices. Whenever the user updates a preference on one device, I want the changes to propagate to all the devices with the app whether they are on the foreground or on the background. Can I achieve this using push notifications {aps: {content-available: 1}} payload?
Is there a restriction on which category of apps can use this?
Thanks
No there isn't a restriction on app category, you just have to implement the proper background mode in your xcode project.
You can use content-available for that, it's meant for when new information is available to the app and you want to update it locally before the user opens the app so it's more readily available. This is a perfect use case of that functionality.
From Apple:
The aps dictionary can also contain the content-available property. The content-available property with a value of 1 lets the remote notification act as a “silent” notification. When a silent notification arrives, iOS wakes up your app in the background so that you can get new data from your server or do background information processing. Users aren’t told about the new or changed information that results from a silent notification, but they can find out about it the next time they open your app.
EDIT: One thing to note, don't make the preferences update only available through the push notification because they aren't 100% reliable. Make the info available to update upon opening the app as well so that you can be sure they got it.

Newsstand Kit: Can an app be launched because an asset has become available?

I'm trying to learn about NK. In what cases is an app launched because it has the newsstand flag set in its main plist? My impression is that it isn't launched in that way, because the NK buffers incoming issues. But I am probably wrong so I wonder: Is an NK-aware app ever launched into the background?
Thanks.
My comment was slightly incorrect. The docs say
The following steps describe the general workflow for getting newsstand content when push notifications trigger the download. If push notifications are not involved, skip the first step:
The server side of the application sends a push notification to client applications when there is a new issue to download.
If an application is not running in the foreground when the notification is delivered, it is activated in the background (or launched into the background, if necessary) to download issue assets. Otherwise, you handle the notification as you would any push notification. See Local and Push Notification Programming Guide for information on how to send and handle push notifications.
The client application communicates with its server and gets URLs locating the issue assets to download. It might also need to obtain the name and date of the issue from the server. In this phase it might also validate that the user is eligible for a subscription or perform any other required authorization.
The client gets the shared NKLibrary instance and sends a addIssueWithName:date: message to it, passing in the issue name and date. This step creates an NKIssue object representing the issue and adds it to the library.
I've added emphasis that the app is launched by the push notification.
Yes, newsstand kit apps that use push notifications are launched into the background to download issues. The linked framework reference may answer further questions.
Documentation: https://developer.apple.com/library/ios/#documentation/StoreKit/Reference/NewsstandKit_Framework/_index.html

Resources