Android :: Keeping Service Alive Across Configuration Changes
Apr 7, 2010
The default way configuration changes (i.e., rotates) are handled is to destroy the activity & recreate it with a new one. What is the recommended way to handle these changes in an activity that binds / unbinds to a service (that is possibly heavy/slow to start)? When the activity gets destroyed, it unbinds & causes the service to be destroyed. When the new activity is created, it binds & recreates the service.
The only choices seem to be:
-- override onConfigurationChanged in the activity. Feels ok, but non - conformant.
-- explicitly start the service & only stop it when the last activity gets an onDestroy that's not due to a config change (i.e., there was no call to onRetainNonConfigurationInstance). Feels icky.
-- explicitly start the service & don't stop it until some amount of time after the last unbind. Ickier.
On a related note, what happens between activity switches within a process, where the first activity (A) starts the next activity (B) & then calls finish() -- is there a guarantee that B.onCreate is called before A.onDestroy? If not, and the activities share a service, the same issue of keeping the service alive during this window exists, but with only the icky workarounds.
View 7 Replies
Nov 23, 2009
Is there a way to keep an Activity in memory after the user hits the back button on it?ActivitySearch is used frequently in my app, however after the user starts it up, then hits the back button, it's destroyed, and the next visit to it requires it be built from scratch again.If after its first construction, I could just request it be paused instead of destroyed on the back button, then I could reuse it. Is there a sensible way of doing this?The only way I could think of reasonably doing it is to combine ActivitySearch with ActivityMainMenu into a single activity, and simply switch views when the user chooses search, but this is probably a bad design.
View 6 Replies
View Related
Jul 24, 2010
I have a large bitmap that i would like to keep in memory when the qwerty keyboard is visible. My app is always in landscape, so this is the only configuration change that will cause a reDraw. I heard this is what onRetainNonConfigurationinstance() is for...but cant figure it out. Can someone point me in the right direction?
View 1 Replies
View Related
Jul 19, 2009
Is it possible to keep service alive even if the foreground app does not run anymore? My app consists of a foreground app (UI) and a service that should keep running in the background until it is being explicitly stopped by the user (similar to a music player). The problem is that if the user opens other apps, my foreground app is being killed by the system (makes sense) but then also the service is being killed by the system (does not make sense).
View 16 Replies
View Related
Jun 30, 2009
How do I make my service always alive?? If my service gets killed because of an exception or if the VM kills my service on low memory, How do I make sure that my service is always running?
View 14 Replies
View Related
Nov 23, 2010
Once we call the startService() method, can we keep the service alive until its explicitly stopped by the user? I want my service to stay alive until the phone is switched off. How can i do this? The idea is that when I receive an incoming call, I want to start recording and once the status changes to idle, I want to stop the recording. I am doing this inside my service. It does work sometimes and sometimes it doesn't. How can I implement such a thing in a service? Can someone help me with this?
View 2 Replies
View Related
Sep 16, 2009
The app widget documentation indicates that the "widget provider"being a receiver of a broadcast service may not exist (the process) beyond the completion of the call.If I want to maintain state between two broadcast events, such as say widgetProvider.onUpdate(), can I start a local service and leave it hanging there until my widgets are disabled? If I didn't explicitly stop that service will it be loaded again and resumed when the device wakes up.
View 4 Replies
View Related
Mar 9, 2010
I have a main application, that at some point spawns a service that checks for updates, if it finds any, it posts a notification with the ink to the update, and then the update service stops. Through the debugger I've noticed that the notification pops up but then disappears once my service is stopped, which I guess makes sense since the Notification object was instantiated within that service. What would be the best practice of keeping that notice available until the user clicks it?
1) somehow attaching the notification to my top service - which might get really ugly --> since that update service is spawned by another sub-service that is spawned by a broadcast receiver... so even if i wanted to somehow pass the object of my top level service it would mess the entire abstraction of my app structure and would force me to keep pointers to it through every event and service that I use... Perhaps there is some other way to get that service through the app's context? or any other alternative?
2) Finding a way to keep my update-service alive until the user presses the notification, but I'm not sure if there is any intent broadcasted that I could listen to...
View 2 Replies
View Related
Feb 8, 2010
I have an app which declares a BroadcastReceiver, the receiver gets the broadcast, does what it needs to, then ends ensuring that everything is tidied up as needed. When I examine the system through the DDMS view in Eclipse the process for the application is still running after the receiver has completed. I've even boiled it down to a simple test case which gets a shared preferences instance from the context, checks a random setting, and then exits, and, when run on the 1.5 emulator (which is the minimum supported OS level) the process is still hanging around.The reason this is an issue is memory usage (which shows under DDMS as around 2MB).I've had queries about why the application still uses up memory even when it's not doing anything, so, my question is; Is this behaviour normal, or have I missed something that would make the process exit?
View 9 Replies
View Related
Apr 14, 2009
I just wondered which frequency is OK to send whitespace keep alive packets onto a TCP connection to keep it alive on a T-Mobile 3G connectivity (the use case is to maintain an idle XMPP session alive). On SFR in France, we are disconnected if idle for 3 minutes, but I guess T-Mobile's timeout is lower. By the way there is a bug in the Smack library, the "keep alive" setting is not enforced, e.g. if you set it to 30s, in the worst case the whitespace will not be sent until the double of this time (60s).
View 4 Replies
View Related
Oct 22, 2010
is there any way to keep my connection alive when the screen goes off? my xmpp connection is disconnected due to ACTION_SCREEN_OFF event,
View 3 Replies
View Related
Jul 13, 2010
I am writing an application to do fileobservation which can be done. Is there any way I can make the application to run in the background without killing it? Unless user restart the phone. Is there any way to do it?
View 9 Replies
View Related
Dec 7, 2009
am developing an app that needs to track incoming calls. I have set up a phonelistener which is launched form a service like so
TelephonyManager tm = (TelephonyManager)getSystemService (TELEPHONY_SERVICE); tm.listen(mPhoneListener, PhoneStateListener.LISTEN_NONE);
This seems to work for a while but then fails to fire after - say an hour. I have tried relaunching the listening in a timertask every 60 seconds but this does not seem to work. Is there a way of keeping a listener alive for a long period of time. I can only assume the system is garbage collecting it.
View 2 Replies
View Related
Dec 10, 2009
I want my service keeps network connection alive even if user presses the power button to shutdown the screen. As I have tested, socket will return exceptions and through CONNECTIVITY_ACTION intent, i know EXTRA_NO_CONNECTIVITY is true. So can current Android keep connection not closed when screen is off?
View 3 Replies
View Related
Sep 13, 2010
Trying to understand the Android framework model. I have an application that needs to have several threads running. On thread gets GPS fixes, another picks up GPS fixes and pushes them to server, and yet another occasionally polls a server for dispatched orders. Some of these threads update status Views as well.
Since I am new to Android, the application framework model hasn't clicked for me. Where are these threads started? Right now I start the threads in the initial Activity, but if I understand it right, once that Activity goes invisible it is stopped. Furthermore, I have to track GPS and network statistics so that I can have a View which may (or may not) be the active View.
View 1 Replies
View Related
Nov 26, 2009
I want to check whether the process is still alive or not through programmatically ,Can i do that i am trying to do it by process name in onCreate method but the issue is that the onCreate method is called always .When i check that in onCreate method i always get the process name and i can not kill the current app and switch to previous one.
View 3 Replies
View Related
Nov 3, 2010
If it is possible to keep an Air for Android application alive during sleep, how can it be done? I know how to prevent sleep and lock but this course is not preferable to some users.
Update
The reason in this case is to keep the video streaming from the phone to a server.
View 2 Replies
View Related
Feb 24, 2010
I am currently firing an Intent to a Broadcast Receiver which in turns starts an Activity.
Then from the same Service another Intent is fired to a Broadcast Receiver thats in the Activity.
The problem is that the Activity isn't getting the Intent meant for it because it is fired before it is alive and the Broadcast Reciever is registered.
I was wondering is there anyway to make sure an Activity is alive before sending an Intent?
View 1 Replies
View Related
Aug 31, 2010
I just started working on android(beginner). I'm stuck in the activity state complexity. I created two activitys(activity1 and activity2). wen i move from the activity1 to 2 and then back to activity1 using a button(back of activity)the values(states) of the views are not restored. here is the code...
View 1 Replies
View Related
Apr 2, 2012
I have a ics tablet, and I am getting really frustrated with Opera mobile keep reloading while I'm in another app or two. my tablet has 1gb ram. I tried autokiller memory optimizer, and auto memory manager to keep opera alive, but its not permanent. and V6 supercharger sounds wayy to complicated for me. and this tablet doesn't have a recovery (its rooted though), so the instruction sounds more complicated to me. so I saw one post in xda somewhere, that I can modify build.prop to set oom priority and it will be kept permanently.
View 5 Replies
View Related
Aug 3, 2012
As of ics when you move browser in the background, that is switch from browser to another app, the flash content on the web page gets paused, like the waiting seconds countdown on a file sharing website, it simply means you can't multitask, So is there a app that can prevent the browser from being dead in the background, or a floating browser will do the trick
View 9 Replies
View Related
Oct 23, 2010
There seems to be a solution for the random shut-down problem with Captivate: Captivate Keep Alive app. This was just posted, and it really seems to work! Give it a try. So far I've been up for more than 24 hours without a shut down event.
View 5 Replies
View Related
Nov 10, 2010
I got pretty good guessing the touch buttons one they time out, but still annoying as I did miss sometimes.Well just now, I decided to do something about it.A real quick poke through the phone revealed a very easy fix.The path is here.Settings[Sound & Display[Keyboard timeout[Same as Screen timeout my screen timeout is 1 min.As we all know, and I verified this. The keyboard backlight only turns on when the slider is open. Now the touch-sensitive buttons will infact stay lit as long as you would need them, while the screen is on .Life just got a little easier B)
View 4 Replies
View Related
Dec 21, 2011
I would like to change the Keep Alive Timeouts in the native SIP Application. I'm using a Nexus S with ICS. But I always get this error
Code:
I/ActivityManager( 152): START {act=android.intent.action.MAIN flg=0x4000000 cmp=com.android.phone/.CallFeaturesSetting} from pid 1745
E/MenuItemImpl( 1745): Can't find activity to handle intent; ignoring
E/MenuItemImpl( 1745): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.phone/com.android.phone.CallFeaturesSetting};
have you declared this activity in your AndroidManifest.xml?
That's what i did:
-Check out Android Source with repo, Tag 4.0.3
-Edited frameworks/base/voip/java/com/android/server/sip/SipService.java
-lunch full-user
-make
-Copied the resulting Phone.apk and Phone.odex from out/target/product/generic/system/app/ to my Phone and fixed permissions.
View 3 Replies
View Related
Oct 6, 2010
I would like to know if the Android handsets can be configured Over-The-Air; in other words, if they can be configured for settings (such as GPRS , WAP or MMS ...) using OTA. If yes, do they support OMA CP provisioning? Is there an XML example that can be used to configure the Android devices?
View 1 Replies
View Related
Nov 24, 2010
I have a simple Android application that loads a page in a WebView, then most of the real work is done by the server-side scripts. Everything is working great, except that I currently have the page URL hard-coded in the Android application, sort of like this:
mWebView.loadUrl("https://www.my-application-url.com");
This was fine until this morning when I was asked to to make it so that the user is prompted to enter the URL the first time the application run, and the URL that is entered by the user is then saved and used automatically by the application from that point onward. I was also asked to make it so that the user can change the URL if they choose to do so. The reason I was asked to do this is so that users can install the server side of the application on their own servers and my Android application will be able to connect without me having to write a custom version for each user, with their URL hard-coded into the application.
I am unsure what is the best way to handle this in Android. It seems that I probably need to add some type of configuration interface to the application that is shown by default on the first run, then only when the Menu button is pressed on the following runs. From this configuration interface I guess I would then get the URL from the user and serialize it for future use. What is the best way to accomplish this?
View 2 Replies
View Related
Jul 24, 2010
This is sort of about task managers, and yet, not. I have an application I need to stay open (meebo) but Androids's task manager closes it sometimes. I have tried using task managers to keep enough memory free that Android won't kill Meebo, but it usually gets killed eventually anyway. Does anyone have an idea on how to keep it open? I am running 2.2.
View 2 Replies
View Related
May 19, 2010
Let me start off my saying I searched this topic before I posted. I am constantly closing apps with them being restarted and I'm not opening them like Music, alarm clock, Amazon mp3 store, moxier mail, etc. The only one I actually use from time to time is music but they open on there own. Is there an app or setting to change this?
View 8 Replies
View Related
Jul 19, 2010
I've only owned an Android for 6 days (Samsung Galaxy S i9000) and one of the first things I installed was Juice Defender, having used iPod Touch extensively, I know how heavy on battery things like WiFi can be. Anyway, JD makes the phone really really leggy. It can take a minute sometimes (literally, 45-65 seconds) for the JD screen to come up when launched. Similarly when waking from sleep it takes ages for the data connections to become active again. Have I misconfigured JD? Is it really this slow and creates this much lag? Does it just not like the (fairly new) i9000? I've just uninstalled it there right now (left Ultimate Juice on) and the phone is much snappier. It's like using it for the first time. Which, considering JD was installed in the first half hour of my owning the phone, it kind of is. What I really wanted was the WiFi on/off according to cell tower location data so I can have it go on and off when I leave the house. Guess it's no real biggie. Having limited background data (e.g. the 2 mins per 15) is handy too. Are there any other apps which have JD functions - even if more limited in scope - that I can try?
View 2 Replies
View Related
Oct 4, 2010
Having some trouble getting handcent configured right. I want it to only show the notification in the top status bar and the dock. I do not want the popup window. Can someone tell me which settings to use? I have tried everything and cannot get it right.
View 1 Replies
View Related