Android: Have a non-intrusive activity transparent/unclickable activity running
up vote
1
down vote
favorite
Explaining this will be kind of a stretch but please bear with me. I've also put a visualization of what I want to do at the bottom of the post.
I have an app with 2 Services
(A, C) and one Activity
(B). The activity is absolutely needed to launch the second service because it creates a GUI that cannot be created from within the service itself as it needs an activity reference.
Service A
is listening and once triggered, will launch Activity B
which launches Service C
.
Because I am currently out of ideas on how to let Service A
communicate with Service C
(C is already bound to B) I thought I would just launch the Activity every time Service A
gets triggered and then hide the activity immediately.
Bad design aside this generally works but there is one major flaw: as I am constantly launching the activity (launchMode="singleInstance"
so it doesn't stack up) it keeps appearing on screen preventing the user from interacting with their phone during that time. I do run moveTaskToBack(true);
immediately to get that Activity
to disappear as soon as possible but it's still visible for a few seconds.
Now I'd like to know how to
A) let Service A
check whether Activity B
and Service C
are running (the user wouldn't mind the activity flashing up once per hour, I just don't want to bring it to front every 15 seconds)
or
B) Make Activity B
"ontouchable" so the touches get passed through and the user doesn't notice it's on screen for a second (I've already made it transparent so the home screen is visible but it's still preventing the user from clicking anything on the homescreen)
android
add a comment |
up vote
1
down vote
favorite
Explaining this will be kind of a stretch but please bear with me. I've also put a visualization of what I want to do at the bottom of the post.
I have an app with 2 Services
(A, C) and one Activity
(B). The activity is absolutely needed to launch the second service because it creates a GUI that cannot be created from within the service itself as it needs an activity reference.
Service A
is listening and once triggered, will launch Activity B
which launches Service C
.
Because I am currently out of ideas on how to let Service A
communicate with Service C
(C is already bound to B) I thought I would just launch the Activity every time Service A
gets triggered and then hide the activity immediately.
Bad design aside this generally works but there is one major flaw: as I am constantly launching the activity (launchMode="singleInstance"
so it doesn't stack up) it keeps appearing on screen preventing the user from interacting with their phone during that time. I do run moveTaskToBack(true);
immediately to get that Activity
to disappear as soon as possible but it's still visible for a few seconds.
Now I'd like to know how to
A) let Service A
check whether Activity B
and Service C
are running (the user wouldn't mind the activity flashing up once per hour, I just don't want to bring it to front every 15 seconds)
or
B) Make Activity B
"ontouchable" so the touches get passed through and the user doesn't notice it's on screen for a second (I've already made it transparent so the home screen is visible but it's still preventing the user from clicking anything on the homescreen)
android
I have thought about sending a broadcast, setting areceived
bool to false and if there is a reply from B and C, setting it to true. A second later it will check whetherreceived
is true. This is pure nightmare code but for now that's the closest I got to getting this to work
– user2161301
Nov 12 at 11:24
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Explaining this will be kind of a stretch but please bear with me. I've also put a visualization of what I want to do at the bottom of the post.
I have an app with 2 Services
(A, C) and one Activity
(B). The activity is absolutely needed to launch the second service because it creates a GUI that cannot be created from within the service itself as it needs an activity reference.
Service A
is listening and once triggered, will launch Activity B
which launches Service C
.
Because I am currently out of ideas on how to let Service A
communicate with Service C
(C is already bound to B) I thought I would just launch the Activity every time Service A
gets triggered and then hide the activity immediately.
Bad design aside this generally works but there is one major flaw: as I am constantly launching the activity (launchMode="singleInstance"
so it doesn't stack up) it keeps appearing on screen preventing the user from interacting with their phone during that time. I do run moveTaskToBack(true);
immediately to get that Activity
to disappear as soon as possible but it's still visible for a few seconds.
Now I'd like to know how to
A) let Service A
check whether Activity B
and Service C
are running (the user wouldn't mind the activity flashing up once per hour, I just don't want to bring it to front every 15 seconds)
or
B) Make Activity B
"ontouchable" so the touches get passed through and the user doesn't notice it's on screen for a second (I've already made it transparent so the home screen is visible but it's still preventing the user from clicking anything on the homescreen)
android
Explaining this will be kind of a stretch but please bear with me. I've also put a visualization of what I want to do at the bottom of the post.
I have an app with 2 Services
(A, C) and one Activity
(B). The activity is absolutely needed to launch the second service because it creates a GUI that cannot be created from within the service itself as it needs an activity reference.
Service A
is listening and once triggered, will launch Activity B
which launches Service C
.
Because I am currently out of ideas on how to let Service A
communicate with Service C
(C is already bound to B) I thought I would just launch the Activity every time Service A
gets triggered and then hide the activity immediately.
Bad design aside this generally works but there is one major flaw: as I am constantly launching the activity (launchMode="singleInstance"
so it doesn't stack up) it keeps appearing on screen preventing the user from interacting with their phone during that time. I do run moveTaskToBack(true);
immediately to get that Activity
to disappear as soon as possible but it's still visible for a few seconds.
Now I'd like to know how to
A) let Service A
check whether Activity B
and Service C
are running (the user wouldn't mind the activity flashing up once per hour, I just don't want to bring it to front every 15 seconds)
or
B) Make Activity B
"ontouchable" so the touches get passed through and the user doesn't notice it's on screen for a second (I've already made it transparent so the home screen is visible but it's still preventing the user from clicking anything on the homescreen)
android
android
asked Nov 12 at 0:33
user2161301
152211
152211
I have thought about sending a broadcast, setting areceived
bool to false and if there is a reply from B and C, setting it to true. A second later it will check whetherreceived
is true. This is pure nightmare code but for now that's the closest I got to getting this to work
– user2161301
Nov 12 at 11:24
add a comment |
I have thought about sending a broadcast, setting areceived
bool to false and if there is a reply from B and C, setting it to true. A second later it will check whetherreceived
is true. This is pure nightmare code but for now that's the closest I got to getting this to work
– user2161301
Nov 12 at 11:24
I have thought about sending a broadcast, setting a
received
bool to false and if there is a reply from B and C, setting it to true. A second later it will check whether received
is true. This is pure nightmare code but for now that's the closest I got to getting this to work– user2161301
Nov 12 at 11:24
I have thought about sending a broadcast, setting a
received
bool to false and if there is a reply from B and C, setting it to true. A second later it will check whether received
is true. This is pure nightmare code but for now that's the closest I got to getting this to work– user2161301
Nov 12 at 11:24
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53254646%2fandroid-have-a-non-intrusive-activity-transparent-unclickable-activity-running%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I have thought about sending a broadcast, setting a
received
bool to false and if there is a reply from B and C, setting it to true. A second later it will check whetherreceived
is true. This is pure nightmare code but for now that's the closest I got to getting this to work– user2161301
Nov 12 at 11:24