Apple push notification without Apple Server - ios

is there a possibility to send Push Notifications to iOS Clients without the use of Apple´s Server´s?!
And on the other Hand is it possible to push a whole file?! like a XML-File for example, or can you just push text messages?!
Another Question, is there any way to push an xml-file to an iOS Client remotely?!

Sorry no this is not possible. With Push notifications the Provider needs to send the notification to the APNS (Apple Push Notification Service) which will send it to the correct device.
This works like:
You are also not able to send files just notifications in the for of Text, sound etc. So no XML file via Push notifications sorry.
You could however do it were you notify the user through Push Notification that there is a file available and then download it when the app opens.
Check here for more on Push Notifications

You can just push text message, sound (actually tell the system to play specific sound on a push, not the actual sound file). All these info are transferred in json format (push notification payload) with maximum size 256 byte and NO there is no way to do it without using Apple Push Notification System (apns).
On your second question you can push the xml file to your app using http request/response (when your app is running, not with push notification).

Related

Can I block receiving iOS Push Notifications during specified hours (night time) programmatically in Swift

my client wants to have an UISwitch control in Settings view in his app which is: 'Disable Notifications during night time'. He would like pushes that his API will be sending to mobile to be ignored if this option is turned on and it's a night time. Is this possible? I know that I can register and unregister for remote notifications, but this requires an App to be turned on. Is it possible to have it working like he wants?
The only way to do this is to have a configuration in the back-end. Notifications are sent from a server, and only handled in the app. There is no way, besides unregistering the phone from receiving notifications, to have the phone deny a notification in a certain time frame.
The user can set a time preference in the app, send it to the server, and have the server do a check so it only sends the notification to the user in the preferred time period.
Check out this 3rd party repo to send your push notifications and just write in your own check before pushing the notification.
https://github.com/nomad/houston
You can register or unregister for push notifications, i hope in your code switch you can make something like this:
let application = UIApplication.shared
//Didnt receive push
application.unregisterForRemoteNotifications()
//Receive push
application.registerForRemoteNotifications()
and if your client wants make this in Backend you can put a value on some database table with field receive:Bool, and the backend just take all the receive == true to send push notification on this devices

Can iOS notification push a file

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

Apple Multiple Push Notifications not visible in Notifications Tray

I basically want to make multiple push notifications in the same application visible in the notification tray in iOS.
This scenario works if my data is on while push notification is triggered via APNS, but only the latest one is received in case I am offline and come back after a while. This functionality is affirmed by APNS documentaion.
However, this is what worked in WhatsApp:
Turned Data Connection OFF
Sent some messages to WhatsApp
Turned Data Connection ON
Saw multiple push notifications received in Apple's Notification Tray
How's this scenario working? Can I use APNS for this? If yes, then how?
See this sample image of multiple Push Notifications in WeChat.
Like you wrote in your question, this is mentioned in the Apple Docs:
If you are sending multiple notifications to the same device or
computer within a short period of time, the push service will send
only the last one.
Link
The only scenario that what you're describing will work is if your whatsApp was open in the background while getting those push notifications. That way whatsApp will handle them as local notifications and will present all of them in the notification center. If whatsApp was closed you'd get only the last notification like any other app.
You can easily test this:
Terminate whatsApp and turn on Airplane mode.
Send your device 5 messages from 1 to 5.
Turn Airplane mode off and lock your device.
You'll only see one msg (the last one you sent aka "5") in your notifications center.
This is how whatsApp is making it work:
While whatsApp is in the background, a single push notification is received (the last one the user sent, "5" in our example). That msg will not be shown to the user.
whatsApp receives it in the method application:didReceiveRemoteNotification:fetchCompletionHandler: and checks against their servers if there are any notifications prior to "5" that the user didn't receive. If that's the case, they will pull that data from their servers and will present it to the user using local notifications which is basically just a way to present data and not related to APNS at all.
It is explained in Troubleshooting Push Notifications. Check for "Some Notifications Received, but Not All" section.
As described you cannot have any control over those push notifications.
However you may know that from iOS7 a new background execution mode (remote-notification) allows the App to be awaken by the system when a push is received, allowing you to process some data, then go back to sleep...
This is probably the trick: using that way to receive the push notifications (silently) and then trigger your own local notification instead as #Segev said. See the UIBackgroundModes here.

iOS Push Notifications without using a server

How do you go about sending users push notifications for automated actions in an app, such as sending them a notification when their lives have been refilled? This doesn't seem like an action that should need a server, but rather the app itself determines when to send out the notification.
What you need is not a push notification, but a local notification. See this question

Push Notification send and receive in iOS?

I want to develop an app regarding push notification.
I want to send a push notification to 5 persons who has installed my app and are stored in my directory.
Can I send Push Notification to 5 people using their UDID which I received from each and every person who has installed App. (As UDID is banned)
I want to send them continuously to 5 persons till one does not press OK button on Alert?
Which service should I use for Push Notification?
Is push notification receives on time or it delays?
You cant send the push notification using UDID, you can use the Apple service for sending the push notifications via device-token and pem file which is explained in below link.
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
Any push notification that isn't delivered immediately was queued for future redelivery because your device was not connected to the service. "Immediately" of course needs to take latency for your connection into account. Outlying cases would be beyond 60 seconds as APNs will time out at that point.
Still you have any query then you can refer the below link http://developer.apple.com/library/ios/#technotes/tn2265/_index.html

Resources