Does anyone have any documentation on this "TooManyMessages" error.
After I call the GoogleCloudMessaging send method I am getting an intent from com.google.android.c2dm.intent.RECEIVE with the following key/value pairs in the extras bundle.
Send error:
Bundle[{error=TooManyMessages,
message_type=send_error,
google.message_id=1,
android.support.content.wakelockid=1}
This means that too many messages were stored in the GCM server for a single device without being delivered (which might happen if your device was offline while many messages were sent by your server).
Once the number of such messages reaches the limit, which is 100 if you don't use a collapse key, they are deleted from the GCM server, and you get that error message, which informes you your device should sync with your server in order to get the lost messages.
Related
I want to send notifications to multiple android devices(where same app is installed) by fcm from php server side by calling this url -
https://fcm.googleapis.com/fcm/send
I checked sending messages to device groups but my requirement is such that there will not be definite devices to which i will send messages because i am going to do it in a hourly cron job, and each time a cron job runs it will send notification messages to different different devices according to requirements. or can it be done in another way?
But i am thinking to use "registration_ids" parameter instead of "to" parameter, details of these fields here in the Downstream HTTP messages section. In this registration_ids field i will put all required device registration tokens in array. Now my question is after receiving message in android device can the message be parsed in the android app sdk codes?. i am in a bit of doubt as in this documentation there are no mentions of registration_ids parameter when sending messages to multiple android devices. Please assure me. And furthermore, will the message be sent when android app is in background?!. Please don't write one line, provide some examples if possible.
In the documentation for building requests to send to multiple devices you will find an example of passing multiple FCM tokens in a single call to the FCM API in the tokens parameter (in Node.js) or by using a HTTP batch request with multiple subrequests (in the REST API).
If you're having a hard time making this work, posting a question that shows what you tried increases the chances that someone can help making it work.
Yes, the message is sent regardless of whether the app is in the foreground, or in background. Whether the notification is actually shown depends on many more factors, many of which are outside of your control (such as the Android version, device maker/OEM, and the user settings).
I am having trouble retrieving all messages through the Gmail API PHP Library. I use listUsersThreads to retrieve all threads to do either a full or partial mailbox sync on a user's account. The initial full sync processes and returns the message ids I need, which I then use to store mail meta headers (from, to, date, subject). A subsequent call using listUserHistory from the last history id, allows me to do a partial sync to only retrieve the latest messages. From the data I have stored, I then display a full message conversation log between two parties, ordered by date to show the conversation. Clicking the message will then query the API to retrieve email body, which I then display.
The issue is that based on the messages I have saved, looking at the MIME content, there are messages in the MIME body, that I do not have on my database. I then also tried to query the API using a search query, and still there are missing messages, not returned by the API.
A previous developer used mimecast to get the messages, and querying that database does in fact return the messages that I'm missing.
How is the Google Gmail API not giving me all messages between sender and receiver? The MIME body clearly shows messages that are not available when querying the API, and I don't understand why, or how to find the missing messages.
Any assistance would be appreciated.
So, for in case this issue comes up for anyone else, I believe that it has something to do with expired history items. I stand to be corrected, as this can only be proved after I've had my implementation running for more than two weeks.
If you're considering running a mailbox sync, there's a good chance that you'll be missing messages, especially if those messages were sent from a client other than Inbox or Gmail. History items are kept for two weeks on average, so by syncing a mailbox, you'll be syncing everything from when the account was activated, but expired history items will not be available.
In theory, this means that you should have the full email conversation while a partial sync is executed. You should have all the MIME headers that you need as and when the communication takes place, provided that, like me, you have push notifications enabled through the Google Cloud Services console to alert your systems to run a partial sync process on any given account.
If your partial sync is executed manually, or possibly through CRON on an interval, rather than through push notifications, you'll need to make sure that the interval is configured to sync while all history items are still available and accessible.
The downside of this, though, is that even if you do have trace of all communication with their message IDs, a lookup on an expired message to retrieve email body will fail with a 404 status code, and you will not be able to retrieve email body contents for some messages.
Thus, if your processes relies heavily on what's in the body of the email, you should also store body content locally during a partial sync I really only need the MIME headers, although I do lookup message contents when needed, but it won't cause major problems for me if I was unable to retrieve the body of any given message.
I should be able to confirm this theory within a month from now, so if you think my theory is incorrect, please feel free to make me the wiser. :)
My purpose: One Push Notification to iOS app, badgeNumber on device need to update based on each device's badge increment.
We knew that we can send only one message (payload) to different tokens
in iOS, We cannot update badge number even we receive remote notification when App is forced to close from background.
I want to use above method to send Different Badge Number to each device, since I get badge number for device from my DB Server.
I used FCM for iOS push notification
for Server-side, I use PHP
Some discussion(Android GCM - Send different payload to each user in registration_ids array )
said it's not possible, so is there any way or paid service?
Some said we need to send each payload to each device tokens using loop. Example, I have 1000 tokens, will APNS block my future request?
For my app's usage: around 50 push/day
Thank for your contribute.
Some notes to your comment:
You can update badge if the application is dead, but it cannot be a silent notification, if silent it will simply ignored. Using a "normal" notification with badge in payload you can, in fact update it even killed manually.
You must keep in database all the device token with user associated, and send individual notification, you can't send bulk message with different content (in this case with different badge).
No, it will not block, you can send for each one:
This is from another forum but can be used as reference:
According to the "Push Notification Troughput and Error Checking" section of this Tech Note:
https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG44
"There are no caps or batch size limits for using APNs."
"If you're seeing throughput lower than 9,000 notifications per second, your server might benefit from improved error handling logic."
I searched a lot but couldn't found any description on properties of responses that are being sent by REST API (http://dev.iron.io/mq/reference/api/#responses) Almost all properties of responses are self explanatory but some properties needs to be described. Let me mention some of them;
In response of GET /projects/{Project ID}/queues/{Queue
Name}/messages/{Message ID}/subscribers request, what is property
ID? (this is not message ID as I have checked it. In case of uni-cast
push queue it is the same number as message_id+1)
In response of GET /projects/{Project ID}/queues/{Queue
Name}/messages/{Message ID} request, what is property
reserved_count?
In response of GET /projects/{Project ID}/queues/{Queue Name}
request, what is property size? (It looks to be queue size from its
value but again what is queue size? Queue Size on my Dashboard always
displays zero)
As per my understanding if a message is retrying 2nd or 3rd time its
retries_remaining should be equal to retries_total - number of
retries attempts. But this is not case. Every time I have seen that
retries_remaining is not changing. What are the cases in which
retries_remaining will change?
After the message is tried retries_total number of times, message
status should be changed to error but it remains retrying. why?
Is there any log of message routing? means, if a message is first
send to subscriber 1 but not received 200 in response. The same
message will be then send to other subscriber say subscriber 2.
In response of GET /projects/{Project ID}/queues/{Queue
Name}/messages/{Message ID}/subscribers request, the property ID is the subscriber ID
In response of GET /projects/{Project ID}/queues/{Queue
Name}/messages/{Message ID} request, the property reserved_count shows how many times the message have been reserved. After reservation if the timeout had been expired, the message would be placed back onto queue and the reserved_count would be increased.
In push queues (in contrast to pull queues) the messages are not stored in the queue. That's why the size of any push queue is always zero.
After the message is tried retries_total number of times the message status always changes to error. I think you had checked the status before the message was tried retries_total number of times. There is also the retries_delay between retries, default value is 60 seconds.
Unfortunately now the routing log is not available, maybe in future will. You can use an errorqueue. It is the name of another queue where information about messages that can't be delivered after retrying retries number of times will be placed. For detailed information navigate to
http://dev.iron.io/mq/reference/push_queues/#error_queues
I don't really know how to ask these but hopefully I can make myself clear enough for you to understand my questions
The message limit is 256. But which is the message I need to impose this limit on?
At first I thought it was referring to json size. But after looking through the code zend use, and others who use push notification, additional information is sent through payload (the json is 256 but the payload sent is 270). Should I limit the json to 240 or less?
What happens if more than one message has the same Id (I'm not talking about device id)
How fast can I send a second message to the same device? I have some problems that only one message arrives.
I use timestamp for Id, so I was wondering if this is the cause of my problem or maybe I can't send 5 messages in the same seccond to a single device.
From Apple Developer site:
The Notification Payload
Each push notification includes a payload. The payload contains
information about how the system should alert the user as well as any
custom data you provide. The maximum size allowed for a notification
payload is 256 bytes; Apple Push Notification Service refuses any
notification that exceeds this limit.
The limit is on complete payload which mean JSON + Your Message. So your message should be limited to 236 characters and then add the character count of following JSON: {"aps":{"alert":""}}.
how fast can i send a second message to the same device? I have some problems that only 1 message arrives.
There is no restriction on sending messages to one device. However, Apple does not guarantee delivery of all of your messages and APNS may deliver only the latest push notification message of the device in case multiple messages have been received from one app which are destined on the same device.
From iOS Developer Library:
Some Notifications Received, but Not All
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.
Here's why. The device or computer acknowledges receipt of each
notification. Until the push service receives that acknowledgment, it
can only assume that the device or computer has gone off-line for some
reason and stores the notification in the quality of service (QoS)
queue for future redelivery. The round-trip network latency here is of
course a major factor.
As described in the Local and Push Notification Programming Guide, the
QoS queue holds a single notification per app per device or computer.
If the service receives another notification before the one in the
queue is sent, the new notification overwrites the previous one.
Thanks to Joachim Isaksson for providing the above link.
Well, the 256 bytes limit is on the binary representation of the JSON payload (the device token as well as the other headers are not included in this count). That means you can send a 256 character JSON string if you only use characters which require a single byte in UTF-8 encoding. If you send text in languages whose characters require more than one byte, you will have room for less characters in your payload. I tested it, and that's how it behaves.
As for sending more than one message with the same id, that would defeat the purpose of the message id. When Apple encounter some error in your message (such as invalid device token), it sends back an error response containing the message id you supplied. If you send multiple messages with the same id, you won't be able to know which message causes the error response.