Now a small project, you need to write a background of Service Service, Service to start automatically at boot, the main function is to read the sensor Service data, socket services are also written in the Service. The problem is you want to get data from the UI Service, should bindService, then when the first switch UI's first Activity Service Solutions and tie, and then get a second Activity bound, so that Service is equivalent to destroy immediately after they onCreate, equivalent to just switch interface, socket must disconnect and reconnect. Is there any other structure to solve this problem it.<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) -> Reply: Under normal circumstances you jump to another screen, even if access to the original meaning of the data is not big. 1 You can not close the Socket, continues to run but no data is passed to the original Activity in the background. 2 You use the radio to replace bindings registered broadcast Activity inside, as long as there is data acquisition sends broadcasts.
Socket This fact is not closed in Service inside. Reply:
Destroy all the Service, Socket thread can survive it. I think radio is really no way to reuse Reply: Bind if you do not, do not display the call stopService, The Service is not going to stop the run, and will not Destory.
Reply: Your Service is a boot on startup, you can be completely passed Activity data broadcasting. Reply:
No comments:
Post a Comment