Android :: Way To Determine When App Is Being Finalized
Mar 21, 2010
I posted a question yesterday about determining when an app is being finalized vs destroyed for screen orientation change. Thanks to the answers I received I was able to resolve my problem with the screen orientation change. However, I am still running into a roadblock.
This app I am working on logs into a website with an HttpClient. As long as the app remains in memory the HttpClient will retain the cookies from logging in. However, once it is killed, it would need to log in again.
My question: How can I determine when the app is being killed from memory so I can set a boolean to false telling the app it has been removed from memory so the next time it starts it will read this and determine is must log in again? Or is it possible to serialize an HttpClient and put that in the savedInstanceState bundle? May extract the cookies from the client and put those in the savedInstanceState bundle? Is there something I'm completely missing here maybe?
View 1 Replies
Aug 29, 2009
I'm acquiring a wake lock and apparently, it gets garbage collected in my app at some point with the following error;
code:...........
What is the recommended approach to overwrite the finalize to force releasing the lock or -better- force the GC not to release the lock ?
View 2 Replies
View Related
Mar 20, 2010
I am relatively new to the Android world and am having some difficultly understanding how the whole screen orientation cycle works. I understand that when the orientation changes from portrait to landscape or vice versa the activity is destroyed and then re-created. Thus all the code in the onCreate function will run again. So here's my situation: I have an app that I am working on where it logs into a website, retrieves data, and displays it to the user. While this is all done in background threads, the code that starts these threads is in the onCreate function. Now, the problem lies in that whenever the user changes the screen orientation, the app will log in, retrieve the data, and display it to the user again. What I would like to do is set a boolean that tells the app if it is logged in or not so it knows whether or not it must log in when the onCreate function is called. So long as the app is in memory the HttpClient will exist and contain the cookies from logging the user in but when the app is killed by the system those will go away. So I would assume that I need to do something like setting the logged in boolean to false when the app is killed but since onDestroy is called when the screen is rotated how is this possible? I also looked into the finalize function and isFinishing() but those seem to not be working.
Shorter version: How can I distinguish between when an app is being killed from memory from when an activity is being rotated and different code for each event?
View 2 Replies
View Related
May 12, 2009
I would like to know how can I determine the value to put in an ACTION tag in AndroidManifest....
We have some defined intent at http://developer.android.com/reference/android/content/Intent.html...... ok.
I tried to do some stuff with receiver. I found an example SMS_RECEIVED. This example work when I use android.provider.Telephony.SMS_RECEIVED in the action. If I try to find these constant in android.provider.Telephony I've a problem...It doesn't exist...So where is it defined?
View 2 Replies
View Related
Sep 29, 2010
I feel stupid asking such a simple question, but is there an easy way to determine whether an Integer is even or odd?
View 5 Replies
View Related
Oct 13, 2009
Is there a way to determine connection speed? E.g. EDGE, 3G, etc.? I already know NetworkInfo.getType() will tell me Wifi or Mobile. I'm looking at Is this NetworkInfo.getSubtypeName(), but the function is undocumented.
View 2 Replies
View Related
Jan 5, 2010
I have an application that uses a Service to fetch data in the background both while the application is running and when it's not. When it is not running i would like to show a notification when there is new data, but not when the app is running. How do i determine in my service whether the app is running or not?
View 6 Replies
View Related
Jan 10, 2010
What is the best way to determine file type in android? I want to check if the given file is image or music file or video or smth else. Could you please give me a small code snippet?
View 2 Replies
View Related
Mar 4, 2010
I am planning to have a Service send a broadcast which a BroadcastReceiver will act on and I would like it to create a Notification if an application is not currently on screen, but if the application is on screen (ie. showing to the user) then I would like to offer a Dialog and not create the Notification.Is it possible to determine if an Activity or application is currently on screen?
View 5 Replies
View Related
Oct 12, 2010
I'm looking for a way to determine user identity so I can globally track game scores off phone.IMEI provides identity of the phone - not effective if phone is on- traded or upgraded by individual. USIM provides identity of phone carrier subscriber - assumes device is phone, and currently has a SIM card.I'd like to be able to provide continuity as a user upgrades to a new device. And I dislike being forced to create an account on each global scoring system, so I don't want to force that on my users. And my end user experience with OpenFeint leaves me disinclined to use it.It doesn't need to be bullet proof. But it does need to be hassle free for my users.Is there any other identifier on an Android device that I can use to link data more cleanly with the current owner? And how would I get hold of that identifier? I'm thinking something like the user's Google account .. or similar
View 12 Replies
View Related
Jan 18, 2010
For example, I am inside a building and I want to get my location with the accuracy of 0.75 (Criteria.ACCURACY_FINE) and this will use the gps if my gps is on. Since I am inside a building, gps won't work. How can I determine if it is really impossible to get a gps fix location?
Is onLocationChanged(Location arg0) will be called even though no gps fix location was received when using LocationListener? Is it possible to use a timeout in requesting gps location so that I can shift to network as the location provider if i can't get any location?
View 1 Replies
View Related
Nov 11, 2010
i have this android application that requires to load data from a remote server via the internet. this update-functionaliy obviously requires the device to not only be connected to some kind of network, but also to the internet.so: is want to schedule the update-service to some date and when it starts, it should determine whether it actually CAN reach the target server or not. therefore, a simple "is the device connected to wifi?" does not suffice, as the device may be connected to a wireless network that does not offer internet access. something like a PING is required.whats the easiest / best way to determine, if there is an internet connection is available i.e. server is reachable?
View 3 Replies
View Related
Feb 19, 2010
Does anyone know if there is a way to identify (in code, not LogCat) when the GC has run? Perhaps an intent is fired? I could analyze the LogCat output, but it would be ideal if I could determine when the GC has run from my code.
View 2 Replies
View Related
Apr 30, 2010
I have an application where I would like to warn the user if they are not using the default Android softkeyboard. (i.e. they are using Swype or some thing else).
How can I check which input method they currently have selected?
View 2 Replies
View Related
Aug 4, 2010
I was looking at the API, and Ive tried to determine this:
On a given port, check if it's available or already some application listens to it.
View 2 Replies
View Related
Jul 1, 2010
Build.VERSION.SDK_INT was added only in API level 4 (1.6). Is it possible to determine if phone has API level 3 (1.5) ?
View 3 Replies
View Related
Feb 22, 2010
I have implemented a BroadcastReceiver which is triggered by the AlarmManager. The AlarmManager is initialized on BOOT_COMPLETED. So i have to declare the receiver in the manifest.
My problem is that i want the BroadcastReceiver only to do something when none of my own activities are in the foreground (aka the user is not interacting with my application). I pull information from a remote server and don't want to notify the user if he is currently in my application anyways.
So far i have not managed to find a way to determine if my application is in the foreground. Is there a way to do such thing? The ActivityManager tells me if my application is running but not whether it is in the foreground.
View 2 Replies
View Related
Jun 10, 2010
Is there an API to determine available internal memory?
View 2 Replies
View Related
Jun 19, 2010
I have a need to classify the device on first run to set some default settings for my games. This is my first time doing this and I've already hit some snags as to how to handle such a thing.
Basically I want to figure out if I can run the game with full quality everything on, which would be for the following phones: Nexus One Droid Incredible EVO X10 Maybe devour, haven't tested Any other snapdragon or cortex/pvr device
Everything else with a GPU gets low quality settings Anything without a GPU gets low quality plus a warning saying that the game will not perform adequately on their device
Ideally, I would retrieve some information like:
CPU = MSM7200, MSM7600, CortexA8, etc.. GPU = MSM7200, PVRSGX530, etc.. - OR - CPU speed = 378Mhz or 600Mhz, or 1000Mhz GPU max = GLES 2.0 or GLES 1.1, etc
but of course that's not really available as I only have a few pieces of information in android.os.Build, which mostly are:
Build.BOARD (IE trout) Build.DEVICE (IE dream) Build.MODEL (IE T-Mobile G1) and then whatever is in /proc/cpuinfo which I could fetch easily through either Java or native.
Examples on the end.
So here are the 3 approaches I was hoping to try:
1) Benchmarking - Run a simple test for 2 seconds and ballpark the raw cpu power from that. Pros - easy to implement, fairly reliable Cons - If it happens to run during a high-load moment on the phone (which can last for several seconds) it will be very far off and will misclassify devices. 2) Use a really big list of DEVICE or MODEL names and check against that list. Pros - It'll work Cons - The list is already over 60 entries and is growing at an incredible rate. It would be very hard to keep it current and keep all the variants straight 3) Pull some raw info out of linux and use that. Pros - Most detailed info available Cons - Can't find things like raw CPU Mhz, OpenGL version support, etc..
cpuinfo for a G1:
Processor : ARMv6-compatible processor rev 2 (v6l) BogoMIPS : 245.36 Features : swp half thumb fastmult edsp java CPU implementer : 0x41 CPU architecture: 6TEJ CPU variant : 0x1 CPU part : 0xb36 CPU revision : 2
Hardware : trout Revision : 0080 Serial : 0000000000000000
cpuinfo for a Nexus One:
Processor : ARMv7 Processor rev 2 (v7l) BogoMIPS : 162.54 Features : swp half thumb fastmult vfp edsp thumbee neon CPU implementer : 0x51 CPU architecture: 7 CPU variant : 0x0 CPU part : 0x00f CPU revision : 2
Hardware : mahimahi Revision : 0081 Serial : 0000000000000000
View 4 Replies
View Related
Apr 9, 2009
I am trying to place only the exact amount of data into a TextView but I need to know how much it can hold. Is there a way to do this based on it's height, width and the textsize?
View 2 Replies
View Related
Jun 2, 2009
Is there any way to determine the layout of a physical keyboard (ex: QWERTY vs QWERTZ)(if there is one)? I would like to map commands to keyboard keys if there is a hardware keyboard available, but the layout is very important. I have had users from Germany complaining that layout is not optimized for their phones (since the Y and Z keys are swapped). Is there any way to automatically detect this, or am I stuck making it a setting?
View 3 Replies
View Related
Nov 21, 2010
I know that it's possible to determine the data connection type (WIFI/or cellular) through Android, but is it possible to determine the cellular connection type and strength?
I have an app that downloads some images and I have found that on GPRS or on 3G with weak signal that this download process slows up the app unacceptably. What I want to do is say that if you have either WIFI or a strong and fast data connection then download; otherwise display a default placeholder image.
View 1 Replies
View Related
Aug 14, 2010
What is an effective way to determine how much free space is on the SD card?
View 3 Replies
View Related
Sep 18, 2010
Is there an app where you can hold the Droid to a sound and it talls you the exact pitch in Hertz? Whether I sing to it or dog whistle to it or play piccolo to it or play a digital sound from my computer onto it?
View 1 Replies
View Related
Mar 17, 2009
In my application I have a table that stores information for symbols. These symbols have to be displayed, so also the source, the *.png, is stored in each row. These symbols are loaded randomly at runtime. How do I get the the image(s) to be loaded? Code...
View 3 Replies
View Related
Sep 15, 2009
By any means, programmatically can I get the install date & time of the already installed apps on the android device. The ApplicationInfo doesn't provide this info. While digging through the /data folder through the DDMS perspective, I saw the installed apk's do contains the Date & time of when it was installed, but the sad part is that this /data folder is not accessible on the device programmatically.
View 3 Replies
View Related
Aug 5, 2010
I need to know, how to recognize, which button is pressed. Like if i have two buttons ,say button 1 and button2,and both of them performing the same method, say method(),how to determine which button pressed?
View 3 Replies
View Related
May 18, 2009
I want to determine a resource string is existing or not. Because other programs in my system will build this string, I need to check the string building is success or not. If fail, I would replace this string as other string. is it possible to check R.build.buildid is existing or not?
View 4 Replies
View Related
Jul 9, 2009
My app has a certain piece of functionality that will only work on a device where root is available. Rather than having this feature fail when it is used (and then show an appropriate error message to the user), I'd prefer an ability to silently check if root is available first, and if not,hide the respective options in the first place.
View 6 Replies
View Related
Jul 7, 2010
Can anyone help me with calculating the speed of Android Device. how to determine the speed with which device is moving.
View 2 Replies
View Related