Feb 2 | 1:50 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Mark M. | turned off guest access |
Feb 2 | 2:20 PM |
Mark M. | has left the room |
Feb 2 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Venkat | has entered the room |
Mark M. |
hello, Venkat!
|
Mark M. |
how can I help you today?
|
Feb 2 | 7:30 PM |
Venkat |
Good day Mark
|
Venkat |
I am using a websocket created by AndroidAsync
|
Venkat |
and need to reconnect in case of network disconnections
|
Venkat |
can I create a dynamic broadcast receiver from a service?
|
Mark M. |
if you mean, can you call registerReceiver() on a Service, the answer is: yes
|
Venkat |
I tried but I do not get any brodcasts if the application is not active
|
Mark M. |
what does "if the application is not active" mean?
|
Venkat |
I mean if the main activity is not in the foreground
|
Venkat |
I am creating a local service which handles the websocket connection
|
Venkat |
sorry if I am not clear ... new to Android / Java
|
Mark M. |
well, I'll admit to never having tried registerReceiver() on a Service, but since the method is defined up on Context, it'll certainly compile
|
Mark M. |
which broadcast are you trying to listen to? CONNECTIVITY_ACTION?
|
Venkat |
yes, please
|
Mark M. |
AFAIK, that should be something you can listen to from a receiver registered via registerReceiver(), whether on a Service or an Activity
|
Feb 2 | 7:35 PM |
Mark M. |
another approach would be to have the receiver registered in the manifest, but then enable and disable it as needed from your service
|
Venkat |
My broadcast receiver has a listener variable which points to the service, if I register it through the manifest then this variable is always null
|
Mark M. |
your manifest-registered receiver would call startService() to send a command to the service, starting it if it is not already running
|
Venkat |
so I was unsure how I can call the reconnect function from the receiver if registered from the manifest
|
Venkat |
ok ... will give it a try
|
Feb 2 | 7:40 PM |
Mark M. |
if you have another question, go right ahead
|
Venkat |
Just a small query - in one of your answers in SO, you refer to the Weather API sample from the advanced guide, do you plan to cover it in the omnibus version of teh book?
|
Mark M. |
no, I replaced that with the Stack Overflow client
|
Venkat |
ok .. will check that out
|
Feb 2 | 7:45 PM |
Venkat |
No more questions for now ... will test out calling startService() from the receiver
|
Mark M. |
OK
|
Feb 2 | 8:15 PM |
moffitj | has entered the room |
Feb 2 | 8:20 PM |
Mark M. |
hello, moffitj!
|
Mark M. |
moffitj, do you have a question?
|
moffitj |
I do
|
moffitj |
I'm trying to set up two-way communication between my xmpp GCM server and my phone. Upstream messages work beautifully. However, downstream messages appear to be empty. I can see from the Smackxmpp debug window that the packet was sent and contains a data field with key:value pairs, but when it arrives in my service and I call intent.getExtras().getString("valuethatIsetonserver"), the result is null.
|
moffitj |
What could cause the intent passed to my service to not include the data that I sent frommy server?
|
Mark M. |
have you dumped the entire extras bundle, to see if something is altering your keys?
|
moffitj |
I did
|
moffitj |
View paste
|
moffitj |
The keys I was trying to send were command and userID
|
Mark M. |
that would suggest that the key/value pairs are being eaten either at Google's servers or in the Play Services Framework's processing of what gets pushed down from those servers
|
Mark M. |
I haven't played with CCS/XMPP on GCM
|
Mark M. |
so I haven't looked to see what the XMPP stanzas should look like, etc.
|
Feb 2 | 8:25 PM |
moffitj |
I think I know the cause then. For some reason the smack debug window is showing all quotes as "
|
Mark M. |
perhaps they're being entity-escaped when you're building the XMPP message
|
moffitj |
I thought this was a display bug, since google happily acked it rather than nacked as a malformed stanza
|
Mark M. |
maybe Google's servers are just being friendly :-)
|
moffitj |
Thanks for the direction
|
moffitj | has left the room |
Venkat |
Mark, have got it working, thanks for your help
|
Mark M. |
oh, good, glad to hear it
|
Venkat | has left the room |
Mark M. | turned off guest access |