Android :: Kill A Service By Another Activity?
Feb 16, 2010
Activity 1 starts a Service, using the standard Intent. Activity 1 starts Activity 2. Then, Activity 1 gets finished().
Now, there's only Activity 2.
How does Activity 2 kill the Service, since that Intent was generated in Activity 1? I don't want to pass the Intent everywhere...
View 2 Replies
Apr 22, 2009
Is there any way not to force to restart the service once the service crash and is killed?
View 11 Replies
View Related
Apr 21, 2010
I have some process that i would like to run in the background the whole time.
so i made it "service".
my question is: is there anyway to prevent from the user to kill this service? (even if he uses third party app)..
View 3 Replies
View Related
Mar 20, 2010
I am looking to code simple application
let's say I have an activity that starts a service which is simply a counter and counter value is reflected on activity UI , when I navigate away from this .I want this counter to be continue and when I get back to Activity I want to see counter count.so the question is
how can a reconnect with the started service and then if I want to kill it ? how can I know the service is already started?
View 3 Replies
View Related
Aug 3, 2010
Based on some quick tests, I've noticed the following: if you kill the Google Messaging Service, Chrome to Phone (a.k.a. Send to Phone) will stop working.
This seems rather obvious, but I had been in the habit of killing the Google Talk Service (GTalk) prior to Froyo. After Froyo, it looks like the service was renamed/replaced with Google Messaging Service.
I suspect that killing the Google Messaging Service could affect other Google services too.
View 3 Replies
View Related
Dec 7, 2009
Any one knows how to Kill my all the activity at a time ?
Am inside so many sub menu if i click exit button there it should close all teh activity and show the OEM Screen.
View 12 Replies
View Related
Nov 11, 2010
What happens here is I call the crop image activity and then the camera activity runs in background. When I finish this activity, the camera is still alive at the background. So how can I kill programmatic the camera activity running in background?
View 3 Replies
View Related
Sep 27, 2010
How can I kill Android activity from asynchronous thread? In my android application, I start another activity using startActivity. Is there anyway for me to kill that activity I started after several minutes?Or is there any way beside using thread?
View 2 Replies
View Related
Aug 4, 2010
I have activity A that starts activity B which starts activity C
A -> B -> C
When a user clicks on a button in activity C, i want to bring A to the top of the stack and take B & C completely out of the stack. Is there a way to do this ? ?
View 2 Replies
View Related
Feb 17, 2010
When the user press the home key, the onPause method is called. At this time, the application is supposed to save its state so it can be properly recovered later.
However, and if the state is taking too much time? For example, issuing a closeAllNetworkConnections that was waiting a feedback from the server, or just if the amount of information we're writting to disk is a lot of info... what would happen?
In my tests, i'm getting from 300-500 ms of time until the process is killed.
Is there a safer place to put a "save everything and quit" code so that it can safely save everything before a "kill the activity" task is issued?
View 3 Replies
View Related
Jun 2, 2010
My application calls Runtime.exec() to launch an executable in a separate process at start up time. I would like this child process to get killed when parent activity exits. Now I can use onDestroy() to handle regular cases, but not "Force quit", shutdowns from DDMS, or kill from the console since those don't run onDestroy(). The addShutdownHandler() does not seem to be invoked in these cases either. Is there any other hook or signal handler that informs my activity that it's about to get terminated? As an alternative is there a way to have the system automatically kill the child process when the parent die?
View 2 Replies
View Related
Jun 30, 2010
Is it possible if my application is running and that time if any incoming call arrives then i want to kill or wait that call (phone activity). any one achieve this type of work in android. i have a no idea how to do this.
View 2 Replies
View Related
Nov 24, 2009
I'm testing how my app behaves when killed by the OS due to low memory conditions. I always have three activities on the stack, like: A B C (then C launches maps or some other heavy process)
when my app is killed, and I return to it, C starts itself up again ok. When I hit the back button to go to B, I [sometimes] get an exception thrown which I can't trace. Output is below. I don't know where to go from here. I've only seen one other post mentioning this exception, but it was related to a reproducable error when rotating the device. This only happens sometimes.
CODE:....................
View 12 Replies
View Related
Aug 2, 2010
Whenever the memory needs to be reclaimed, the process is being killed by Activity Manager Service in killPidsForProcess. I have a back button in my activity window on right corner of the title bar.
I want to kill the activity completely on clicking the close button. Can I reuse the same function and will it have any major effect? Please help me out in this.
View 3 Replies
View Related
Sep 10, 2010
I need to made an activity (without layout) that on start check if a service is running. if it is true it starts Activity2, if it false it starts Activity1.
I tried with this code:
CODE:............
Enter code here
But when I check, in the onCreate method, if serviceConnect!=null I receive sometime a NullPointerExcption.
I tried also to insert the operation in the method onCreate in an Async Task:
CODE:............
View 2 Replies
View Related
Dec 17, 2009
I have the startup auditor and Task Panel apps. I want to try and setup the phone to always have as much memory available as possible. Most of them are pretty obvious but there are a few I'm not sure of. Does anyone have a comprehensive list of services/processes/etc. that we can safely kill off and/or set for auto-kill/disable at startup? Edit: One I was curious about is Google Partner Setup. I have killed it off without any issues through Task Panel. But would having it on the auto-kill list be OK?
View 7 Replies
View Related
Nov 19, 2010
There seems to be a lot of controversy about how to stop applications in Android, so I'll explain what I'm trying to do and why in hopes that I can receive some guidance on how to properly implement the functionality I'm looking for. I got tired of plugging my phone into power when I get into the car, connecting the headphones, turning BT on, turning WiFi off, and then launching "Car Home" because my dock doesn't do so automatically--it's just a piece of plastic mounted to the dash. So my application automatically does these things when I connect power--and when I disconnect power, it turns BT off and WiFi back on, but unfortunately, Car Home is still running. I want to automate the entire process, so I never have to launch (or shut down) Car Home, and make getting in and out of the car a little less frustrating. What is the best way for me to tell the "Car Home" application to stop specifically because power is disconnected and I'm getting out of the car, without me having to navigate to it's home page and click "Exit"?
View 4 Replies
View Related
Dec 9, 2009
In my android application, I start another activity using 'start Activity'. Is there anyway for me to kill that activity I started?
View 1 Replies
View Related
Feb 17, 2010
Suppose I have an Activity that's a list. It calls a Service when this Activity starts.The Service will do background stuff download, parse, and fill the list.My question is this: How can the Service communicate with the Activity?How can I call a method in the Activity, from the Service? (I'm new to OOP)
View 2 Replies
View Related
Jun 12, 2010
In Virgil Dobjanschi's talk, "Developing Android REST client applications" (link here), he said a few things that took me by surprise. Including:
Don't run http queries in threads spawned by your activities. Instead, communicate with a service to do them, and store the information in a ContentProvider.
Use a ContentObserver to be notified of changes.
Always perform long running tasks in a Service, never in your Activity.
Stop your Service when you're done with it.
I understand that he was talking about a REST API, but I'm trying to make it fit with some other ideas I've had for apps. One of APIs I've been using uses long-polling for their chat interface. There is a loop http queries, most of which will time out. This means that, as long as the app hasn't been killed by the OS, or the user hasn't specifically turned off the chat feature, I'll never be done with the Service, and it will stay open forever. This seems less than optimal.
Long question short:
For a chat application that uses long polling to simulate push and immediate response, is it still best practice to use a Service to perform the HTTP queries, and store the information in a ContentProvider?
View 1 Replies
View Related
Jan 13, 2010
Our application will expose a Service that can be called by Activities in other people's applications.In many cases, the parent applications calling Activity may be paused before our Service completes. I am looking for the best way for a Service to communicate back to the calling Activity that may have been paused.These are the known options:
(1) Require calling Activities to have a registerReceiver() with a custom action and broadcast to that from our Service. The only way to secure this registerReceiver() is with a signature-based permission.As our Service communicates with any number of unknown 3rd party apps,we can't sign our Service's parent app with all these unknown certificates. These apps would therefore be exposing an unsecured registerReceiver() on their Activity. Would ideally like to avoid requiring this.
(2) Create a PendingIntent to send results back to the activity and give it to our Service. Our Service would send data to calling Activity's onActivityResult(). Each time the result is delivered, the calling Activity will go through onPause() and onResume() but this should be OK.
(3) The calling Activities could create a Handler. The Activity would then create a Messenger pointing to that Handler and send it to our service. Our Service can then use the Messenger to deliver our message back to the calling Activity.
View 2 Replies
View Related
Sep 3, 2010
I have a launcher activity which gets activated everytime i start the application and a service which complements it. Now as i press the return key from my main activity .Its Ondestroy gets called.Now i have nullify the pointer of the my launcher activity there. now i am listening through the service any event happening on the network after closing the launcher activity thread and if any event occurs i have to relaunch my launcher activity. i have tried intent but doesnot seems to get though it .
View 4 Replies
View Related
Oct 6, 2010
I have a service (input method) and from within that service I want to start and activity which was declared in the same manifest. The activity maybe running but in the background.
How do i check its presence and bring it to front, or optionally start this.
From what I can gather from other posts, this is about what I need to do:
CODE:..............
I don't knwo which of thest flags pertain to what I need to do. The docs are quite merky, and my random attempt at making this work failed.
View 4 Replies
View Related
Oct 16, 2009
My application has a background process which continuously waits on a socket for receiving messages and it should be started only once and at the time of application starting.Thus i want to do that background job in a service.
The service should not be started from the activity ,it should be started at the application starting.
How can i define the service,which will be started at the time of application starting?
If at all the service is started from activity.The activity can be destroyed and restarted.when this happens the service also be restarted .
View 7 Replies
View Related
Jun 14, 2010
How can I start a service from an Activity ?
View 4 Replies
View Related
Feb 25, 2010
In my app i have an activity from which i want to start an Service.
View 3 Replies
View Related
Aug 11, 2010
Is it possible to start an Activity from a Service? If yes, how can we achieve this?
View 1 Replies
View Related
Nov 19, 2010
i am writing an app in which i need a background service to call an activity and show some result.
View 4 Replies
View Related
Dec 16, 2009
I am working on an android application, where the activity binds to a local service to perform certain tasks.Now I am binding the service in the OnCreate method of the Activity, after which the activity has to use the service object to invoke the functionality defined in the servicein the OnStart method. The problem here is that once a call "bindservice" has been made, we might not get the serviceobject immediately, so my service object would be null till that time. So i cannot invoke the service functions.So is there a way to determine in the activity that the service has been bound and the service object is valid and could be used now. For reference i'm attaching a code snippet for the same.
View 2 Replies
View Related
Mar 13, 2010
Can an Activity be bound to two different Services at the same time or do I have to unbind one Service before binding to the other one?
View 2 Replies
View Related