hanafey (16) [Avatar] Offline
#1
In the onCreate method you call bindService which apparently asynchronously sets stockService in the ServiceConnection callback.

Immediately after the bind an AsyncTask is executed, and in the doInBackground callback you make use of stockService.

The question is, is it guaranteed that onServiceConnected will always be completed before the doInBackground is executed?

An alternative would be to put the async task inside the onServiceConnected method to ensure proper order of execution.
mgalpin (2) [Avatar] Offline
#2
Re: Listing 5.9 The main Activity binding to the Service -- concurrency?
That is a good catch. The much better way to do this is trigger the use of stockService to load the stocks member variable, during the onServiceConnected callback. I've updated the code and the manuscript to reflect this.
antipodeanvi (5) [Avatar] Offline
#3
Re: Listing 5.9 The main Activity binding to the Service -- concurrency?
Is there any way with I could get an advanced peek at this code when the source is updated on this issue.

I am in trying get a widget (remote client) to bind to a service through the IPC mechanism. What is not clear to me is the role and configuration of the proxy packaging in a remote client. Using Set<> structure????? I would have thought the Activity manager would not mind handling either (Internal or external). An unit example of would be really helpful.

Also l would love to understand how the alarm manager wake lock mechanism works in its entirety. Your text is helpful. But I do not see the whole picture. How do you configure the broadcast receiver in the manifest? For example. Again, a simplified unit example of would be really helpful.

Thanks in advance.

Mat Hallam-Eames antipodeanvi
charlie.collins (125) [Avatar] Offline
#4
Re: Listing 5.9 The main Activity binding to the Service -- concurrency?
I can't speak for Michael, but if the source has been updated it's probably been checked in (http://code.google.com/p/android-in-practice/source/browse/). Also, as for the manuscript, any recent changes should be in the new MEAP that went out today.
antipodeanvi (5) [Avatar] Offline
#5
Re: Listing 5.9 The main Activity binding to the Service -- concurrency?
Hi Charlie,

Brillant....
Thanks for the link.

Mat Hallam-Eames