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)



enter image description here










share|improve this question






















  • 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















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)



enter image description here










share|improve this question






















  • 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













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)



enter image description here










share|improve this question













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)



enter image description here







android






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 at 0:33









user2161301

152211




152211












  • 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
















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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Bressuire

Vorschmack

Quarantine