0
我在應用程序中有一個本地服務,它在asynctask中執行一些網絡操作。android本地服務問題
在我的應用程序有兩個活動,活動A和B.活動
我服務的生命週期和活動,是這樣的。
In activity A:
1)stop service(in oncreate)
In activity B:
1)start service(in oncreate)
2)bindservice(in oncreate)
3)unbind service(in on destroy)
In service:
1)start download in async task(in oncreate)
2)stop async task(in ondestroy)
但是服務仍在running.is有什麼iam失蹤? 感謝
FIX:
i need to stop the async task before i call stopService. As the service is busy with asyn task, it will ignore my my stop requests.
1)send a msg to service in intent extra, to stop async task.
2)then call stop service
我不想停止活動B中的服務,我想阻止它在一個如果用戶再次--thx啓動應用程序 –
在這種情況下,您需要解除活動A中的服務。 –
我發現該缺陷,請參閱更新後的帖子。非常感謝你的幫助。 –