[android-developers] Re: how can I check if an Activity is visible or not?
Well, that is actually not a bad idea. Thanks for the tip ! On Feb 16, 12:58 am, Marco Nelissen marc...@android.com wrote: Since you're going to do this from your service, why don't you have your Activity register with the service when it is started or resumed, unregister when it is paused or stopped, and then just have the service keep track of whether the activity is active that way? On Sun, Feb 15, 2009 at 6:44 PM, pperotti pablo.pero...@gmail.com wrote: Well ... maybe to clarify what Im trying to get done. I want just to launch a notification to the user only if he is not in one of the screens (Activities) of my application. If the user find himself using the application I just want to move him to the next screen. Basically ... if ( the user is using my app) { startActivity(new Intent(...) ); } else{ // Launch the appropriate notification just not to be intrusive } I was checking in the Activity/ActivityManager public interface, but I dont quite get how to check if the user is actually using my application of not. Can you explain me a bit more how to do this with the approach you mention ? or if there is an alternative way to do it ? Thanks again for the time. Pablo On Feb 13, 12:57 am, Dianne Hackborn hack...@android.com wrote: Please don't do this, these APIs are only really for writing system information tools. For example, for this to work correctly need to retrieve -all- possible running activities (which can be 10, 20, 30, or more), have all of that information copied to your process, and look through it for the activity you are interested in. If your code is in a service a good way to do this is to just have the activity tell the service when it is resumed. On Thu, Feb 12, 2009 at 6:50 PM, Dan Raaka micromys...@gmail.com wrote: Get the RunningTaskInfo through the ActivityManager and do a name match for the activity name you want to exclude and send the notification -Dan On Feb 12, 5:34 pm, pperotti pablo.pero...@gmail.com wrote: Hi, does anybody knows if it is possible to check if an Activity is at a moment of the time visible ? My question is because I want to implement a service and only invoke a different activity (by launching an Intent) only if the previous activity was visible. In case for instance, the user is in a different application I just want to send a notification. My problem is that I dont know how to determine if my application is being use at a particular time, so, I can properly move to the user to the right screen. Thanks ! Pablo -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how can I check if an Activity is visible or not?
Well ... maybe to clarify what Im trying to get done. I want just to launch a notification to the user only if he is not in one of the screens (Activities) of my application. If the user find himself using the application I just want to move him to the next screen. Basically ... if ( the user is using my app) { startActivity(new Intent(...) ); } else{ // Launch the appropriate notification just not to be intrusive } I was checking in the Activity/ActivityManager public interface, but I dont quite get how to check if the user is actually using my application of not. Can you explain me a bit more how to do this with the approach you mention ? or if there is an alternative way to do it ? Thanks again for the time. Pablo On Feb 13, 12:57 am, Dianne Hackborn hack...@android.com wrote: Please don't do this, these APIs are only really for writing system information tools. For example, for this to work correctly need to retrieve -all- possible running activities (which can be 10, 20, 30, or more), have all of that information copied to your process, and look through it for the activity you are interested in. If your code is in a service a good way to do this is to just have the activity tell the service when it is resumed. On Thu, Feb 12, 2009 at 6:50 PM, Dan Raaka micromys...@gmail.com wrote: Get the RunningTaskInfo through the ActivityManager and do a name match for the activity name you want to exclude and send the notification -Dan On Feb 12, 5:34 pm, pperotti pablo.pero...@gmail.com wrote: Hi, does anybody knows if it is possible to check if an Activity is at a moment of the time visible ? My question is because I want to implement a service and only invoke a different activity (by launching an Intent) only if the previous activity was visible. In case for instance, the user is in a different application I just want to send a notification. My problem is that I dont know how to determine if my application is being use at a particular time, so, I can properly move to the user to the right screen. Thanks ! Pablo -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how can I check if an Activity is visible or not?
Since you're going to do this from your service, why don't you have your Activity register with the service when it is started or resumed, unregister when it is paused or stopped, and then just have the service keep track of whether the activity is active that way? On Sun, Feb 15, 2009 at 6:44 PM, pperotti pablo.pero...@gmail.com wrote: Well ... maybe to clarify what Im trying to get done. I want just to launch a notification to the user only if he is not in one of the screens (Activities) of my application. If the user find himself using the application I just want to move him to the next screen. Basically ... if ( the user is using my app) { startActivity(new Intent(...) ); } else{ // Launch the appropriate notification just not to be intrusive } I was checking in the Activity/ActivityManager public interface, but I dont quite get how to check if the user is actually using my application of not. Can you explain me a bit more how to do this with the approach you mention ? or if there is an alternative way to do it ? Thanks again for the time. Pablo On Feb 13, 12:57 am, Dianne Hackborn hack...@android.com wrote: Please don't do this, these APIs are only really for writing system information tools. For example, for this to work correctly need to retrieve -all- possible running activities (which can be 10, 20, 30, or more), have all of that information copied to your process, and look through it for the activity you are interested in. If your code is in a service a good way to do this is to just have the activity tell the service when it is resumed. On Thu, Feb 12, 2009 at 6:50 PM, Dan Raaka micromys...@gmail.com wrote: Get the RunningTaskInfo through the ActivityManager and do a name match for the activity name you want to exclude and send the notification -Dan On Feb 12, 5:34 pm, pperotti pablo.pero...@gmail.com wrote: Hi, does anybody knows if it is possible to check if an Activity is at a moment of the time visible ? My question is because I want to implement a service and only invoke a different activity (by launching an Intent) only if the previous activity was visible. In case for instance, the user is in a different application I just want to send a notification. My problem is that I dont know how to determine if my application is being use at a particular time, so, I can properly move to the user to the right screen. Thanks ! Pablo -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how can I check if an Activity is visible or not?
Get the RunningTaskInfo through the ActivityManager and do a name match for the activity name you want to exclude and send the notification -Dan On Feb 12, 5:34 pm, pperotti pablo.pero...@gmail.com wrote: Hi, does anybody knows if it is possible to check if an Activity is at a moment of the time visible ? My question is because I want to implement a service and only invoke a different activity (by launching an Intent) only if the previous activity was visible. In case for instance, the user is in a different application I just want to send a notification. My problem is that I dont know how to determine if my application is being use at a particular time, so, I can properly move to the user to the right screen. Thanks ! Pablo --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how can I check if an Activity is visible or not?
Please don't do this, these APIs are only really for writing system information tools. For example, for this to work correctly need to retrieve -all- possible running activities (which can be 10, 20, 30, or more), have all of that information copied to your process, and look through it for the activity you are interested in. If your code is in a service a good way to do this is to just have the activity tell the service when it is resumed. On Thu, Feb 12, 2009 at 6:50 PM, Dan Raaka micromys...@gmail.com wrote: Get the RunningTaskInfo through the ActivityManager and do a name match for the activity name you want to exclude and send the notification -Dan On Feb 12, 5:34 pm, pperotti pablo.pero...@gmail.com wrote: Hi, does anybody knows if it is possible to check if an Activity is at a moment of the time visible ? My question is because I want to implement a service and only invoke a different activity (by launching an Intent) only if the previous activity was visible. In case for instance, the user is in a different application I just want to send a notification. My problem is that I dont know how to determine if my application is being use at a particular time, so, I can properly move to the user to the right screen. Thanks ! Pablo -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---