Android :: Detect If Activity Front Most And Visible To User?
Jun 28, 2010
I would like to launch an intent when any of my activity is visible, otherwise I will put it up as a notification, and will be fired by the user. To decide this, I need to know if any of my activity is front-most, how do I that?
View 3 Replies
Feb 5, 2010
Can you please tell me how can my activity detect user pressing HOME key?
View 2 Replies
View Related
Apr 28, 2009
I want to know is there a way one can check(programmatically) whether currently virtual keyboard is visible or not? I want to run some code when the keyboard is visible. Is there a even that occurs when the keyboard is being visible and when it goes back to hidden state?
View 7 Replies
View Related
Oct 14, 2010
How to detect if there is a front camera and if there is how to reach and use front camera ?
View 1 Replies
View Related
Oct 13, 2010
How to check if the android phone has a front camera too? I'd tried to use some help form https://docs.google.com/View?id=dhtsnvs6_57d2hpqtgr but Camera camera = FrontFacingCamera.getFrontFacingCamera(); sometimes works sometimes not.
View 1 Replies
View Related
Aug 6, 2009
It 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 { ...
View 2 Replies
View Related
Jan 19, 2009
I want a countdowntimer to halt on a menu and also when the user goes from that menu to another activity. When the user comes back from that activity or when the menu is closed, the timer should still halt. However when the user went to the home screen and clicks on the icon again, I want the timer to restart. So my question is, is there a way to detect if the user has just opened your application, or if the user comes back from another activity or menu?
View 4 Replies
View Related
Aug 5, 2010
Say that TaskA is currently in the foreground and my ActivityA is somewhere within its stack. Is there a way for ActivityA to get notified or detect when the user switches from TaskA to TaskB? As a use scenario, when the user launches my app, my ActivityA will always be the root Activity of the newly created Task. ActivityA will make use of Activities from other Apps, which will be pushed on the same Task. I would like to get notified when the user has switched to another application. In this case, onStop() in MyActivityA does not suffice as that will also get invoked if the user navigates to another screen within my app.
View 5 Replies
View Related
Nov 17, 2010
I want this same behavior even when the app is in the foreground but user doesn't interact with the app for a long-time say 6-7 mins... Assume the screen is ON all the time... I want to detect kind of USER INACTIVITY (No interaction with app even though the app is in the foreground) and kick start my count down timer.
View 4 Replies
View Related
Sep 21, 2010
I 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);....................
View 1 Replies
View Related
Jul 21, 2010
I would like to know if android has some kind of 'idle time broadcast message'. So for example if the user is currently using one activity of my application but haven't touched the screen or used any keyboard (and doesn't have the autolock at phone level or any screensaver) for a while, I would like to be informed (let's say after 60 seconds). I would like to avoid doing it manually (by tracking each user click, touch, activity changes...)
View 2 Replies
View Related
Nov 20, 2010
I'm writing an application and I have a feedback screen. When the user presses submit button, it takes him to the default email client and prefills the email address, subject etc. ("mailto:") When the user presses Send, my application appears and I thank the user for giving feedback. However, how can I tell if the user has pressed the Discard button and did not send the email?
View 1 Replies
View Related
Jan 10, 2010
I want to detect when a user taps anywhere in a view in my Android application. My code looks like this:
linearLayout = (LinearLayout) findViewById(R.id.linearLayout); // main layout
// ...
linearLayout.setOnTouchListener(this);
// ...
public boolean onTouch(View v, MotionEvent event) {
Toast.makeText(this, "Touch!", 1000);
if (event.getAction() == MotionEvent.ACTION_DOWN) {
Toast.makeText(this, "Down!", 1000);
return true;
}
return false;
}
but when I click on the view, I don't get Toast! Do touch events work in the emulator -- or have I got something wrong in my code?
View 2 Replies
View Related
Oct 27, 2010
I'm currently working on a project which requires the detection of user state (walking, running, driving), I've looked through some of the existing solutions on Android platform such as pedometer or calculating velocity with given acceleration, but I'm still unsure how I can approach this problem. Is there a way to accomplish this without much of data mining/signal processing? How can I solve this with simple logic? Or is this better solved with gps instead of accelerometer? The program will only need to return simple user-state descriptions like walking.
View 1 Replies
View Related
Feb 15, 2010
Is 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 Related
Sep 9, 2010
I don't want my app to crash if the user doesn't have wifi or 3g connectivity. How can I catch this at runtime in my app?
View 1 Replies
View Related
Jul 20, 2010
I have a code that will prompt user to send a message by selecting the desired application, how can I detect if the user actually have chose from the options or instead pressed Back? I tried to check if the intent returned something, but is running asyncronous so cannot be tracked. Also I have tried to run the intent with startActivityForResult, what I noticed in onActivityResult that resultCode is always 0(RESULT_CANCELED) even if user selected, or not from the chooser.
View 1 Replies
View Related
Jun 17, 2010
How can I know the visible size of my activity? I'm trying to get the Activity real size, not the height and width from getHeight() and getWidth(),which gives me the screen full size.
View 2 Replies
View Related
Jul 30, 2009
In an activity, how do detect the fact that the user pressed the home button?
View 6 Replies
View Related
Sep 6, 2010
I'm trying to get an Android background service to be "notified" when the user chooses a phone number (he wishes to call) from the phone's contacts list. My goal with this is to prevent the system from placing the call and present a user with a choice dialog, then go from there.
View 1 Replies
View Related
Apr 3, 2010
I need to know when the user is panning the map so I can check if they've panned outside of the initial radius that I fetch data from the API with when the app launches. If the user pans outside this radius, when they stop panning I will get the new center point of the map and fetch new data with that geo-point. So far I can't find anything in the Google Maps API docs [and I've inspected the entire class tree] that notifies developers when any animation actions are occurring or completed.. It seems weird that Google wouldn't give us some sort of event listener or protected method to override on the MapView or something to do this.
I looked into what methods were available to override on the View class and it does have onAnimationEnd() but I guess panning or zooming the map doesn't count as an animation or is never passed up from the MapView or something... I tried running a simple log in onAnimationEnd() and it is never being called. Searching the interwebs gave me nothing but some never-successfully-answered posts.
View 6 Replies
View Related
Dec 24, 2009
Visiting www.google.com on the Android browser (or even with an android spoofed user-agent), presents the option to "Share Location". When clicked, it uses the GPS/Cell phone towers to figure out the location. I tried the google.loader.clientLocation but that only works using the IP address. Is there a method to tap into the Android OS and access GPS data from a regular web application (and not an Android application) similar to the way Google does? [Perhaps Google uses the Google Gears app on Android to access this data.]
View 3 Replies
View Related
Mar 15, 2010
Does anyone how I go about detecting when a user presses on a bitmap which is inside a canvas?
View 2 Replies
View Related
Feb 17, 2011
I've got an app that needs to handle Android versions 2.2.1 and above differently than 2.2. I'd rather not create two separate apps, but I haven't been able to find a way to identify what version of Android is running on the user's device.
View 9 Replies
View Related
Oct 12, 2010
I would like to be able to detect when a user types a key in the Search Dialog. I plan on using this to hook in to custom suggestion functionality.
Note: The built-in Search Manager custom suggestions functionality won't work for me because I need to customize the layout of the suggestions.
View 1 Replies
View Related
Apr 14, 2010
Lets suppose that i have an activity A, that activity is moved to background(function moveTaskToBack is used), and after while i want to bring this activity to front again. This code is used: Activity A = getActivity(); Intent i = new Intent(A, A.getClass()); i.setAction(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_LAUNCHER); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); A.startActivity(i);
Activity is on screen, but when i invoke later moveTaskToBack on A activity, activity is not moved to backgorund. Does anyone know why?
View 4 Replies
View Related
Nov 18, 2010
I've an ImageView in a LinearLayout, how can I detect when user drag his finger from any place in the screen to inside of ImageView?
View 1 Replies
View Related
Jul 21, 2010
Suppose my application P started Activity A, and A started Activity B, then the activity stack contained A and B, with B at the top.
After that, I opened other apps by pressing Home button. Suppose after a while, the process of application P is killed by the OS. Then, I press Home button to select application P. At this time, which activity will be brought to the front, Activity A or Activity B?
View 1 Replies
View Related
Aug 7, 2010
I am experimenting with using a WebView to display Flash content inside my activity. Everything is working pretty well, but when the user hits the home key to put the activity into the background, the Flash content keeps running (sound keeps playing, etc)
I have noticed that both the stock Android browser and Dolphin Browser seem to avoid this problem, and properly pause the Flash content when the browsing activity is put into the background.
Ideally I would like a solution that kills the WebView completely if the activity is finishing, but pauses it otherwise (basically copying the default behavior of the browser)
Here is a simple test I put together that loads a game on Kongregate which has some background music:
CODE:..............
I took a look at the latest source for the stock browser, and it seems to be doing something similar (calling pauseTimers/resumeTimers), although I fear the code I have been looking at is out of date, because it is calling functions that don't seem to exist anymore.
I did verify that the call to pauseTimers is working by testing with a simple JavaScript setInterval which updates a counter. Is there something else obvious that I should be trying in regard to Window or View management?
The documentation for the mobile Flash player says:
Flash Player will also automatically pause SWF playback it is not in view or the foreground application, for example when a call is received or alarm goes off, to reduce CPU utilization, battery usage and memory usage.
This seems to be working perfectly in both the stock browser and Dolphin Browser, but not in my app. Any ideas/solutions would be greatly appreciated!
Update: Here is the function we ended up adding to our activity to get this to work. We call it with "onPause" in the activity's onPause function and "onResume" in the activity's onResume function:
CODE:....................
View 2 Replies
View Related
Mar 17, 2010
I am aware my issue is against the philosophy of Android, but I have no choice, this application will run on a embedded car gps and I need to bring an activity to prevent from car accident, for example, when it's happen around the user. I have to put other activity on the back and bring my alert pop up without user manipulation like notification on the front. Is there a way to bring manually an activity to the front, by resuming it like when you click on the android task switcher?
View 2 Replies
View Related