When IOS uses APNS to push Payload in bytes, the push fails.

Source: Internet
Author: User

When IOS uses APNS to push Payload in bytes, the push fails.


In the past two days, you need to add a script to the push. You can add a script to the badge method. However, the push fails. I have been depressed for a long time and search for relevant information online.
I finally found the reason:
"Payload -- a maximum of 256 bytes."

It turns out that the payload Bytes Sent exceeds the specified characters.
Use payload. getBytes (). length to get the number of bytes. Check that the number of characters below is 240 bytes, no more than 256. After repeated tests, we know that bytes is not accurate enough. Some values in the original payload are removed (loginUri logon, uri is used for redirect). test again and push is successful.


========= Payload ==========
Originally:

{"LoginUri": "http: // 192.168.1.8: 8086/admin/msm/login", "messageID": "580", "aps": {"alert ": "Zheng zixuan sent you a work item", "sound": "default", "badge": 5}, "uri": "http: // 192.168.1.8: 8086/admin/msm/login? Module = WEIBO & moduleId = 93f7cf993df34d3dbc1681f08cced08c "}=== number of bytes === 250
New:

{"MessageID": "608", "aps": {"alert": "Zheng zixuan sent you a work item", "sound": "default "}, "uri": "http: // 192.168.1.8: 8086/admin/msm/login? Module = WEIBO & moduleId = caedadfd80f841538a3414ca737c2ab0 "}=== number of bytes === 187
======================================

Original address: http://www.eqishare.com/read.php? Tid-980.html

More articles: http://blog.sina.com.cn/s/articlelist_1238625327_5_1.html


Is the push (APNs) fee charged for iOS and Android?

Apple's APNs push does not charge traffic. The maximum load for each push notification is 256 bytes. However, there are resident processes in the device background to maintain real-time SSL connections (or pure
When the Wi-Fi environment is in standby mode at the same time), this requires additional traffic, but not much.
Android push compares traffic fees, and each of its applications establishes a persistent connection link.

The Iphone can only be pushed in wifi environments, but not in cmnet. How can I solve this problem if I cannot establish a connection with APNS?

This is why mobile companies have disabled the push function. It cannot be solved. As far as I know, mobile networks in Jinan, Chongqing, and other cities cannot be pushed. The port is blocked. However, a few cities are normal, such as Beijing.
You can install a backgrounder software. Instead of pushing the software, you can run QQ and other software in the background. However, this consumes power.

The solution is to change the China Unicom 3G card. Originally, the iPhone was designed for the WCDMA network.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.