Hi
In my application I created a service in which I download stuff from the
internet.
The code of the service looks like this:
class SomeService ... {
@Override
public void onCreate() {
super.onCreate();
Thread t = new Thread(fetch);
t.start();
}
private Runnable fetch = new Runnable() {
public void run() {
while (true) {
do_fetch();
sleep(1000);
counter ++;
}
}
}
}
The problem is, when I turn the screen off, the thread t seems to be paused
(I used the counter to find this).
How can I keep the thread running even if the screen is off?
(BTW Strangely, if I connect the phone to the computer, the thread will
keep running even if the screen is turned off.)
Thx in advance.
--
Sincerely Yours,
Chi Zhang
[email protected]
College of Computer Science and Technology, Zhejiang University
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en