Silent Click Notification Not Works in iOS 7

The WWDC 2013 presentation, What's New in Multitasking, has a section called Alerts Without Sound. It seems straightforward. According to the presentation, if you send an APS payload with a content-only value of 1, users will not be notified of this notification.

// A. This doesn't work { aps: { content-available: 1 } } 

My testing shows that this does not work, since no click was received. But if I turn on the sound attribute but exclude the alert attribute, it works (although it is not silent).

 // B. This works { aps: { content-available: 1, sound: "default" } } 

However, if I change the audio attribute to reproduce a quiet sound, I can simulate a quiet push.

 // C. This works too. { aps: { content-available: 1, sound: "silence.wav" } } 

Somebody knows:

  • If this is a mistake?
  • And if you correctly assume that B or C is considered as a remote notification (and not an error with silent push, where do you need the sound attribute)? If so, that means it's not a speed limit like Silent Pushes ... which Apple is likely to fix. Therefore, I probably should not rely on this.
  • What is the speed limit (N presses every X seconds, etc.)?

Thanks in advance.

Edit with more information

For A, the state of the application does not matter. A notification is never accepted.

It seems that B and C only work if you include the attributes and values ​​in quotation marks, as shown below.

 {"aps":{"content-available": 1, "sound":"silent.wav"}} 

And the notification comes in the application: didReceiveRemoteNotification: fetchCompletionHandler:, regardless of state.

+85
ios ios7 push-notification
Oct 08 '13 at 5:26
source share
12 answers

It also works and does not play sound when it comes:

 { aps = { "content-available" : 1, sound : "" }; } 

EDIT

People having this problem may want to check out this link . I participate in a thread on the Apple Developers Forum, which looks at all the states of applications, and when silent clicks are accepted and not accepted.

+69
17 Oct '13 at 13:23
source share

So, I just stumbled upon this question yesterday, and after trying to send a payload with sound set to an empty string, it still caused vibration / sound on the device. In the end, I came across a blog post with Urban Airship asking me to post:

 { priority: 5 } 

in a push notification that I have never seen. After viewing Apple docs for push notifications, I came across this page:

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html

Indicates that priority should be set to "5" or "10", and explains:

Priority notifications. Specify one of the following values:

10 An accurate message is sent immediately.

A push notification should trigger a warning, sound, or icon on the device. The error of using this priority for pressing containing only the key available for content.

5 A push message is sent at a time that saves power to the device receiving it.

Ultimately, we could receive silent push notifications that work with icon counting (and I suspect you could do the same with the alert) in the following format:

  aps = { badge = 7; "content-available" = 1; priority = 5; }; 
+30
May 28 '14 at 16:54
source share

I tried setting an empty string as a warning attribute, and it also worked:

 { aps = { "content-available" = 1; "alert" = ""; }; } 

APNS seems to be checking for these attributes in order to check the push payload. Interestingly, they do not check the actual content. Seems a bit hacky though ...

+10
Nov 22 '13 at 12:27
source share

I use tool- Knuff to send my push notification to my device.

It looks like this: enter image description here

Then I tried this example.

They all work! But you must set priority 10!

So if you do not use the tool, you also pay attention.




Examples:

  • no alarm, no sound

 { "aps":{ "content-available":1, } } 
  • alert only

 { "aps":{ "content-available":1, "alert":"" } } 
  • only sound

 { "aps":{ "content-available":1, "sound":"" } } 
+5
Sep 06 '16 at 11:06
source share

This works for me:

 { aps: { content-available: 1 } } 

Look, check the Background fetch box under Project Capabilities > Background Modes

+4
Nov 03 '14 at 3:26
source share

I see the same problem. If I send push with "content-available": 1 and no other attributes are set, a notification will never be received. When I add any other attributes, it works fine.

As a temporary work, I add the badge attribute, as this does not warn the user with anything other than adding an icon to the icon.

Let me know if you have found the best solution.

+2
Oct 17 '13 at 10:39 on
source share

Priority should be set as one element in the binary stream, but not in the payload jload line. Apparently, only the most recent type of the 2nd format can be used when setting the priority as follows:

 $token = chr(1) . pack('n', 32) . pack('H*', $deviceToken); $payload = chr(2) . pack('n', strlen($json)) . $json; $identifier = chr(3) . pack('n', 4) . pack('N', $notification); $expiration = chr(4) . pack('n', 4) . pack('N', time()+86400); $priority = chr(5) . pack('n', 1) . chr($priority); $frame_data = $token.$payload.$identifier.$expiration.$priority; $frame_length = strlen(bin2hex($frame_data))/2; $msg = chr(2) . pack('N', $frame_length) . $frame_data; 

Types of formats (first byte) for a binary remote notification message:

0 - simple (old) 1 - extended (old) 2 - last with a lot of parameters (new)

+1
Jul 23 '15 at 8:17
source share

Argh! Also pulling my hair is not so much the answer as another example of a payload that DOES NOT work. The didReceiveRemoteNotification method is never called, although if the device is asleep, a warning text is displayed.

  {"aps": { "alert":"alert!", "sound":"default", "content-available" : 1}, "content-id":21482, "apt":"1" } 

"apt" is a custom field that we use to indicate the type of notification.

0
Oct 24 '13 at 21:47
source share

Setting "sound" to 0 worked for me ... :)

0
Nov 05 '13 at 0:54
source share

the priority of setting for 5 did not work for me, but setting the sound or warning to an empty line led to the notification being treated as a high priority

0
Feb 26 '16 at 4:41
source share

We had the same problem without notice. In our case, we used a quiet push to update the icon number. When we set empty lines for notification (body text and heading) and sound, this will work, but if any of the keys is not present, it will fail. Here's what worked by updating the icon without sound or warning (log of the resulting userInfo dictionary in didReceiveRemoteNotification)

 { aps = { alert = { body = ""; title = ""; }; badge = 103; "content-available" = 1; sound = ""; }; } 
0
May 10 '18 at 5:18
source share

This is the year 2019, and this problem still exists. I can also make silent notifications work only when I add a blank sound or icon to the payload. It seems we are all missing something important ...

0
Jul 19. '19 at 0:30
source share



All Articles