アプリケーションにローカル サービスがあり、asynctask でネットワーク操作を行います。
私のアプリケーションには、アクティビティ A とアクティビティ B の 2 つのアクティビティがあります。
私のサービスのライフサイクルと活動はこのようなものです。
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)
しかし、サービスは実行され続けています。何か足りないものはありますか? ありがとう
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