[android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread FrankG
Yes, if you have both sides in your hand. But the basis of my assumption was, that this is not the case. Example Requirement : Don't pop up the triggered dialog, if a certain 3rd Party dialog is already shown. Good luck ! Frank On 23 Aug., 14:10, nation-x

[android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread Call_Waiting
I'm just trying to check from a service what's on the top of the activity stack, because the app starts another app instantly in onCreate(), from previous settings. I'm looking to kill my service automatically without having to comeback to my program at all. So I'm just looking for a way to

Re: [android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread Frank Weiss
I suppose you could simply have the activity, when it comes to foreground (onResume), go ahead and stop the service? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To

Re: [android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread Mark Murphy
On Tue, Aug 24, 2010 at 8:09 PM, Call_Waiting team.mu.capt...@gmail.com wrote: I'm just trying to check from a service what's on the top of the activity stack You assume there is one activity stack. Each task has a stack: http://developer.android.com/guide/topics/fundamentals.html#acttask You

[android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread Call_Waiting
Ok maybe, I have the Activity Stack mannerism wrong. But the fact that when you hit the back button it knows to go from your app, to another app that's not your's, or to the home screen. Theirs a list somewhere in memory for it to do this. By checking the foreground from my service, is knowing

Re: [android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread Frank Weiss
What does turning off my app mean? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to

[android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread Call_Waiting
killing the service = turning off my app But my app works, and I can turn it off from the activity. I'm just need a check to see when to trigger it. I think Hackborn is on the right track with getRunningAppProcesses(). The first time you start my app - input your settings, one of these is an

[android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread Call_Waiting
Thanks Murphy and Hackborn. I think I found the answer. http://developer.android.com/reference/android/app/ActivityManager.RunningTaskInfo.html#topActivity On Aug 24, 7:04 pm, Call_Waiting team.mu.capt...@gmail.com wrote: killing theservice= turning off my app But my app works, and I can

Re: [android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread Frank Weiss
I'll think you need to more precise what that trigger is. Previously, you've been asking how to know what activty is on top of the stack. It seems that the activity on top of the stack is the one your activity started. So I would say the trigger is the moment when your activity starts the other

Re: [android-developers] Re: How to check the Foreground Process from a Service

2010-08-24 Thread Dianne Hackborn
Please stop saying I am on the right track. I am really trying very hard to tell you *not* to do this, because it is not going to be a robust solution. Not this, not RunningTaskInfo. These APIs are not there for applications to base their UI flow on, but to do things like show the user the

[android-developers] Re: How to check the Foreground Process from a Service

2010-08-23 Thread FrankG
Hello Frank, one reason for this kind of question could be, that his service get an hardware event and would like to start i.e. a dialog. But his service is not allowed to hide another Activity. Such a scenario I could imagine. Best regards. Frank On 23 Aug., 06:38, Frank Weiss

[android-developers] Re: How to check the Foreground Process from a Service

2010-08-23 Thread nation-x
You can send a broadcast to your foreground process using a receiver that triggers the foreground process to call a method in the service from onReceive(). Android Workz On Aug 20, 4:25 pm, Call_Waiting team.mu.capt...@gmail.com wrote: Does anyone know how to, or if it's even possible to check

[android-developers] Re: How to check the Foreground Process from a Service

2010-08-22 Thread Pent
Does anyone know how to, or if it's even possible to check the (foreground process/top of the activity stack) from a service? It is possible, see the ActivityManager class functions like getRunningAppProcesses(). getRunningTasks() looks useful but is flakey in my experience e.g. when you return

Re: [android-developers] Re: How to check the Foreground Process from a Service

2010-08-22 Thread Dianne Hackborn
Note that these methods are very much not intended for doing anything except presenting UI to the user about what is running. Do not rely on them to drive logic in your app. You will ultimately be unhappy. On Sat, Aug 21, 2010 at 11:35 PM, Pent tas...@dinglisch.net wrote: Does anyone know

Re: [android-developers] Re: How to check the Foreground Process from a Service

2010-08-22 Thread Kostya Vasilyev
The OP didn't specify whether he needs to track activities of other apps, or his own. If it's his own activities, it could be as simple as tracking state changes in activities' onStart/onStop or onResume/onPause. More reliable, too. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 23.08.2010

[android-developers] Re: How to check the Foreground Process from a Service

2010-08-22 Thread Chris Stratton
I had something sort of working once, but it kept doing things like reporting an ime as the foreground, rather than the activity it was accepting input on behalf of... which made it useless for my purpose. On Aug 22, 4:29 pm, Dianne Hackborn hack...@android.com wrote: Note that these methods are

[android-developers] Re: How to check the Foreground Process from a Service

2010-08-22 Thread Pent
Note that these methods are very much not intended for doing anything except presenting UI to the user about what is running.  Do not rely on them to drive logic in your app.  You will ultimately be unhappy. That paragraph should go in the docs IMO, save people finding out the hard way. Pent

Re: [android-developers] Re: How to check the Foreground Process from a Service

2010-08-22 Thread Frank Weiss
I'm curious what the OP was trying to accomplish. It seems to me that even if the informastion were available, it could be out of date in a very short matter of time. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group,