Вопрос

I have a semi-successful app on the market that uses broadcast receivers for a few of its features. As a request from many of the users, I have successfully excluded a few activities from the "Recent Applications List" by adding this line to the activities in the manifest:

android:excludeFromRecents="true"

I am trying to do the same thing with my broadcast receiver. I have tried adding that line to my receiver and all of the dependant activities to no avail. What can I do to "hide" the broadcast receiver from the user? Is this supposed to work, or is there an alternative?

Also, how do I stop the app from showing in the task manager (running application list) when a broadcast is received? There are quite a few apps on my phone (my app included) that show up in my 3rd party task manager that do not show as running applications in the default settings->apps->running list. Can somebody please explain why this is the case, and what I can possibly do to keep it off the task manager list as well (without knowing how the each individual task manager searches for apps)?

Thanks!

NOTE: I use the word "hide" apprehensively. It is basically to de-clutter the recent applications list as requested by the users. No ill intents :D.

Это было полезно?

Решение

When you receive the broadcast start/launch the new activity/service with FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS. It's hard to tell without the source code, but you may also want to add FLAG_ACTIVITY_NO_HISTORY.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top