Android :: Programatically Detect Foreground Application / Screen?
Aug 20, 2009Is there any way for a backfround task to programmatically detect or recognize by learned id which application or screen (different package) is showing?
View 5 RepliesIs there any way for a backfround task to programmatically detect or recognize by learned id which application or screen (different package) is showing?
View 5 RepliesIt would appear on a G1 (with the latest software update) that onUpdate () runs even when the widget is not visible. Is there a way of sensing that the widget is or is not visible or is otherwise in foreground? That is, running the code below shows a logcat message at whatever interval the Widget is scheduled to update, whether it's in foreground or not, whether even the screen is dim or otherwise in deep sleep. It would seem onUpdate should only be scheduled to run when the Widget is in the foreground or visible. Is this a defect in the G1, or is there some other API call to detect if the Widget is visible?
public class HomeScreenWidget extends AppWidgetProvider { ...
I want to write a service for Android platform that is notified when the current foreground activity changes. Basically the service should do some tasks only when the top activity changes. Is there any way to subscribe and to be notified when this kind of event occurs? Or there is no possibility and the service should poll from time to time the list of running activities and to check what is the foreground activity ?Not preferable solution...
View 1 Replies View RelatedI am developing an application that has to capture the key events both in foreground and in background. I used the following code. But am unable to capture the keys in background.
CODE:............
I used broadcast reciever..
CODE:.................
Is it possible to get listed the apps or activity which are actually displayed on the screen of the android mobile. I need to display a text box on some event when no acitivity is displayed, excepting the home screen.
View 3 Replies View RelatedI wish to have one application that runs in the background, which knows when any of the built-in applications (messaging, contacts, etc) is running. So my questions are: How I should run my application in the background. How my background application can know what the application currently running in the foreground is.
View 4 Replies View RelatedI want to implement the versioning feature for my application manually. For that I intend to compare the application version currently installed on the device and the application version present on android market. I can get the installed application's version using PackageManager , but how to find out the version of the application on the android market programatically ?
View 2 Replies View RelatedIn Android, how do I get the application's id programatically (or by some other method), and how can I communicate with other applications using that id?
View 3 Replies View RelatedIs there a way to programatically get the path to the databases/files an application uses instead of hardcoding "data/data/mypackage.com/database.db" ?
View 1 Replies View RelatedWe are writing an app to substitute screen/pattern lock on G1. Unfortunately, it is impossible to substitute the original screen lock app with a 3rd party one. The only option left is if we can UNLOCK the phone from a service running in the background when G1 is locked. Is it possible? Is there interface to Pattern/Screen lock? What is KeyguardManager for?
View 8 Replies View RelatedIn my application there are three activities A -> B -> C -> A. I want to detect application's idle time, so that after 15 mins it will pop up a message irrespective of activity. what is the best method to implement this.
View 2 Replies View RelatedI would like to know if the user is using the application for the first time. I am using SharedPreferences, but I am not sure if I have the right logic. How can I set my isFirstLaunched boolean to true when the user first launches, and then immediately set to false after work has been done?
protected void onStart() {
super.onStart();
if(isFirstLaunch()){
populateDefaultQuotes();
//Save the preferences, isFirstLaunch will now be false
SharedPreferences settings = getSharedPreferences(Constants.PREFS_NAME, 0);....................
How do you programmatically detect the application heap size available to an Android app?
I heard there's a function that does this in later versions of the SDK. In any case, I'm looking for solution that works for 1.5 and upwards.
My music application constantly plays music in the background, however I'd like to be able to detect when another application starts playing audio (such as the YouTube app) so I can pause/mute/stop the audio in my application. This will allow a user to continue browsing the web whilst listening to music, but then if they wish to watch a video at any point, they can do so without audio conflict.
One solution might be to listen for a broadcast which states when an application begins using the AudioManager. Does such an Intent Action exist? Edit: As in the answer provided below, there appears to be a method of detecting the loss of audio focus in 2.2 with AudioManager.OnAudioFocusChangeListener.
How to detect application launch and shutdown events?
I have used BroadcastReceiver for detecting incoming message, outgoing call and so on. but now I want to use Application Launch and its Shut Down event from my application..
Kindly waiting for any suggestion/link/source code....
I am looking for a way in which I can detect any tap on the screen (not just in my app), I don't mind not having the information of what the tap was (control/letter), just the fact that a tap was made will suffice for me for now. Is there any possible way to achieve this?
View 4 Replies View RelatedAs mentioned in a previous question, I am having difficulty intercepting all android.intent.action.SCREEN_ON events without a long-lived service (discouraged). I may be able to work around the need if I can simply work out when the screen is on at any given time, in the service.
View 3 Replies View RelatedHow can I detect the screen is on or off?
View 3 Replies View RelatedI am trying to detect Screen backlight On / Off.
I've found android.intent.action.SCREEN_OFF related its event.
But I don't know how to use this.
Can you suggest me about how to detect screen backlight on / off ?
I missing some example or sample code.
I recently bought a HTC Desire which I've become exceedingly fond of.I've read (and been told by a colleague who owns a HTC Legend) that wifi should automatically turn off while the screen is off to conserve battery. I have the impression that I should be able to see the wifi icon turn on as I turn on the screen and unlock the phone. However, I haven't noticed that happening: The icon seems to just be on always.I have then tried observing my router's DHCP table when the the screen is off, but I haven't observed the entry for my phone disappearing (and I don't really know how much time has to pass before the table not showing my phone.Are there any settings that can cause this behaviour? What about programs? I current use smart monitor to log data usage as well as locale (using a SSID plugin and not the locale "location" condition). The only services I can see apart from those I think are OS services, are the ones for locale, smart monitor lite and the SSID plugin.
View 5 Replies View RelatedI'm writing a customized view similar to Grid which will be used to hold a large amount of images. I'm using ImageButton to display the images, and I only want to load images onto the buttons once they are on the screen (and just display a static background image when they are not). The reason for it is that I'm fetching images from some back-end service and I only want to fetch them when the buttons are on the screen.To do that, I'd like to know if the widget is on the screen. Is it possible to detect if a widget like button is on/off screen? If not, any suggestions on how to achieve what I'm trying to do?
View 1 Replies View RelatedHow do I get the current screen resolution (width and height)?
View 10 Replies View RelatedI have a motion listener to detect finger down, finger drag, and finger up. I start my action at finger down and finish my action at finger up. When the action is finished, I store it in a stack for allowing undo. My problem is that if I don't get a finger up event, I can't finish my action to add it to the stack for undo.
How can I detect that the user's finger has left the screen?
I tried using the emulator to see if getEdgeFlags() ever returned anything useful, and the result was always 0.
Basically, if a finger leaves the screen, then nothing is touching the screen anymore and I would like to detect that as a finger up event. How can I do this?
I've got an onTouchEvent boolean on a Surfaceview, I've got openGL objects drawn on the view and I'm wondering is there anyway to detect where on the screen the onTouch happened? e.g (x,y) co-ordinates.
View 1 Replies View RelatedIs there any way where I can detect that the screen is about to turn off, so I can do some work *before* it happens?I need this to work around bug 3755: OpenGL apps sometimes crash when the screen gets turned off because they don't get surfaceDestroyed /surfaceCreated() events. Simply put, I need to shut down OpenGL before the phone has a chance to detach the GPU. The only events I seems to be getting when the screen turns off are onPause() and onWindowFocusChanged both of which turn up *after* the GPU detaches, by which time it's too late.
View 7 Replies View RelatedI've checked the WallpaperService.Engine class and don't see anything.What's the best practice for detecting home screen sliding?
View 3 Replies View RelatedI have an application that has many screens. Is it possible to detect if the screen NOT belonging to the application (not defined in my android manifest) comes into visibility?
View 1 Replies View RelatedI'm currently implementing a live wallpaper. This is also visible, when the device is locked. Now I want to show different content, when it is locked but can't find a way to detect this. PowerManager can only change the settings and the wallpaperEngine only gives me a general onVisibiltyChanged() method, which triggers every time you return to the home screen.Dos anybody know a way to detect if the device is locked?
View 2 Replies View RelatedIs there a way, some API one can call to detect if the user has set a screen unlock pattern or not?
View 2 Replies View RelatedI need to set different content view after rotating device screen. Is there any method to detect the direction of current screen is vertical or horizontal?
View 6 Replies View Related