question

lamozarax avatar image
lamozarax asked

onMessage won't be called until sync button clicked

When I send a message to ADM server and get the correct response from it, my handler's onMessage function won't be called until I click the sync button on the status bar or I restart the wifi (that will force the kindle fire to sync). But I do prefer instant notifications on my user's device if i send them messages. Anyone can give some help? Thanks in advance.
amazon device messaging
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
So the receiver which revives the message from the adm client has to be checked. Is the Class which extends ADMMessageReceiver (example : class MessageAlertReceiver extends ADMMessageReceiver) registered dynamically or Is the receiver declared in the manifest itself. because when adm client gets the message from the server it should be able to find the right filter to pass the intent. FYI: abstract ADMMessageHandlerBase-->(IntentService) - class has onMessage,onRegistrationError,onRegistrationError,etc methods
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kashimatakumi avatar image
kashimatakumi answered
Hi Bipin, thank you very much for your reply. But I'm afraid that i didn't explain my problem well. I have registered my handler and receiver in the AndroidManifest.xml and my handler's onRegistered() get called immediately I call adm.startRegister(); However, onMessage() does not behave the same way. When I send a message to ADM server and get a 200 status code from ADM, onMessage() won't be called immediately. Sometimes it get called after 5 mins I got response. Sometimes it takes more than 2 hours. But any time I press the sync button on the status bar, onMessage() will definitely be called. And I got the same result when I use the sample code from the SDK. So I would like to ask whether sync is a must for receiving message and whether ADM can act like an instant message system. Thanks in advance.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

lamozarax avatar image
lamozarax answered
Hi Bipin. I'm sorry that lamozarax and kashimatakumi are both my account. Sorry for causing the trouble.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
ADM messages should be pushed down from the server to the device at the time of enqueue. While there is a polling mechanism, it's infrequent and shouldn't be the main mode of communicating messages to the device. If the the device connected behind a firewall or something similar, it could affect the ability of messages to be pushed to the device, potentially causing the behavior you are seeing.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

lamozarax avatar image
lamozarax answered
Hi Bipin, your kind reply is really appreciated. Your answer makes sense. Cheers,
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

adm-ms avatar image
adm-ms answered
Hi, I have the save issue and have been testing the problem on different networks. I ensured that all the necessary ports are open which include 5228, 5229, and 5230. Unfortunately, I still got the same result. Therefore, I'm just wondering if there's a way for the device to sync with ADM periodically so it can check if there're notifications in the queue and fetch them. Thanks
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
Hi, As on now all the logic of fetching data is in the ADM client. Syncing from application will defeat the concept of push message.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.