============ Problem Description ============
Recently in an application, real-time detection of network signals, the log is the system automatically crawl, a service detection log to meet certain conditions, began to compress the archive, I use Asynctask to detect the network signal, the signal value through progress update to the foreground, after the application started, open a service to detect the log situation. Now the problem is that when the log reaches the start of a compression, will block the foreground signal updates, one is a service, a background task, 're told will not block the main thread, there is only one process to send messages to the mobile phone? I hope you have more advice ~-~
============ Solution 1============
Aidl Bai, very useful,,,
============ Solution 2============
Although Asynctask is a background task, it is not suitable for long-time tasks.
============ Solution 3============
The official documentation gives the description that Asynctask does not build a generic threading framework and cannot perform time-consuming operations up to a few seconds. Note that asynctask and a normal thread are not the same.
============ Solution 4============
Reference 4 Floor jeky198306 's reply:
Thank you for guidance, do you have a good way to deal with this? Got aidl. To install two applications, the user experience is not good
Quote: Referring to the reply of the 3 floor Lionfresh:
The official documentation gives the description that Asynctask does not build a generic threading framework and cannot perform time-consuming operations up to a few seconds. Note that asynctask and a normal thread are not the same.
You can also detect network signals in another service, and broadcast to notify the UI thread to update the interface.
============ Solution 5============
The service runs in the main thread, the service blocks the UI, and the Asytask Doinbackground is another thread.
============ Solution 6============
How do you get points?????????????????????
Ask questions about Android background tasks and services