Changing push notification sound to a file not in the app bundle? - ios

Is is possible for a user to record a new sound to be used as the sound for the push notifications they receive from the app? In other words, is it possible to dynamically change the push notification sound using sound files uploaded externally, or do they have to be already located in the app bundle?

From the Push notifications programming guide:
For remote notifications in iOS, you can specify a custom sound that iOS plays when it presents a local or remote notification for an application. The sound files must be in the main bundle of the client application.
So I would think that it's not possible, sorry.
The notifications will often be processed by the system while the app is closed, so I don't think there is a way to configure its behaviour beyond the basic features.

Related

Swift iOS: Silent push, triggers app to make sound and vibration?

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.

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

How don't allow iOS to start application when specific type of push notification arrives?

I want PHP server send to my iOS application two types of push notifications:
New income message. For this push I want iOS start my application if it was suspended, show badge, play sound, etc.
New friend request. I don't want this push to start my application and I only want to handle if the app is in the foreground.
How can I achieve this? How can I handle different push notifications differently?
I'm not sure if it will work, but you should try for your 2nd scenario to send a notification that contains only custom properties. In this case there will be no alert to display, sound to play nor badge to update, so I think this notification will only reach your app if it's already running.
For the 1st scenario, send a notification with pre-defined properties (alert, sound, badge).
Application-side handling for remote notifications should start with the method in the application delegate protocol application:didReceiveRemoteNotification:.
However, in order to avoid the application launching in the first place, you need to make sure the PHP server crafted notification doesn't offer the option to launch the application.
See the documentation on the Apple Push Notification Service here:
http://developer.apple.com/library/ios/#DOCUMENTATION/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9
In particular, you want to focus on the content of the aps dictionary as documented in The Notification Payload section. The aps dictionary received can badge your application's icon without opening the app at all.

Can the user disable sounds for push notifications locally?

I'm using APNs, I have two questions around the use of sounds or buzzing.
Can we just have the device buzz, instead of playing a sound?
Can the user disable sounds via their local system settings for my app? If not, I'd have to build a remote service to let them opt out of sounds for push notifications, and store that option on my server.
I don't know about just buzzing, but yes, the user can disable sounds for push notifications from your app. In the Notification settings for your app there's a switch called "Sounds", just under "Badge App Icon".

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