Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - How to make a Service run ONLY when no other app is running?

How to make a Service run ONLY when no other app is running?

Put your problem here if it does not fit any of the other categories.

How to make a Service run ONLY when no other app is running?

Postby lgmcben » Mon Nov 17, 2008 8:15 am

I've successfully created a service that change the wallpaper every 2 seconds.

My next goals:

I want this service to...

- auto-stop itself when user launch other app.
- auto-start itself when the wallpaper is visible. (eg. when users close all other apps)

The only clue I have is, when user press the device's "home" button, Android will launch an activity of category "Android.intent.category.HOME".

Which can help me a bit but obviously not enough (as pressing back button also make wallpaper visible, but no event fired)

Any recommendations are welcome.

Thank you in advance. :)
lgmcben
Junior Developer
Junior Developer
 
Posts: 24
Joined: Mon Nov 17, 2008 5:06 am

Top

Postby MrSnowflake » Mon Nov 17, 2008 11:57 am

I don't know if there is an accessible Activity stack, but try to look for it and when the Home app is on top do your stuff in the service, otherwise sleep(1000) and check again (a wait of 1 sec should slow down the phone :)) .
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 12 guests