Android :: Activity Blocks Till Service Completes
Oct 10, 2009
I am starting a service from an activity. Once the services starts, the calling activity loses focus and blocks till the service is completed. Why is this and is there a way around it to return the control to the calling activity while the service runs in the background?
View 6 Replies
Jan 13, 2010
I've got an activity that calls a helper class called DownloadManager. DownloadManager spawns a thread that downloads a mp3 to the sdcard. I'm having some trouble finding the best design for resuming the initial activity and starting the MediaPlayer. Does it make the most sense to use a BroadcastReceiver that receives a message that download is complete, then start a new Intent of my activity? Think I saw something that I can't use an Intent to start an Activity from BroadcastReceiver because it is a background process.
View 4 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
Jun 29, 2010
Droid Blocks is a classic sliding block puzzle with a sci-fi twist and over 500 levels.
You can get it from the marketplace (lite version also available) or from Droid Blocks Official Website for only 1.99$.
View 3 Replies
View Related
May 13, 2010
The default behavior of an activity when BACK softkey is pressed is, GO BACK TO PREVIOUS ACTIVITY. If some the same activity is waiting for some response from server or some data updation is going on and then press BACK, I want to wait on the same screen till the current task is completely processed and then move out to the previous activity.
You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options
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
Oct 25, 2009
When I flip the keyboard, the layout changes from portrait to landscape, activity is recreated but any background thread keeps running. How can I prevent orientation change/activity from being recreated until my background thread finishes.
View 2 Replies
View Related
Nov 10, 2010
Has anyone attempted to update either their Profile or their PRL recently? I have been trying to do both (because it's good to do every once in awhile, and I'm trying to see if it'll help with my 4G issue) and it gets stuck in the preparation stage and never completes.
View 5 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
May 6, 2010
I want to stop an Activity that is in some other application from my Applications service. Is there any mechanism to do so?
View 6 Replies
View Related
Aug 8, 2010
Is it possible to close/finish activities in activity stack from a backgorund service.
View 2 Replies
View Related
Jun 10, 2010
I have a service running in the background. It starts on device boot. Also, I have one activity (that appears in the task launcher) in which I have provided buttons to start and stop the service.
Now, I install the application on the phone and I start the service using this activity (and not on-device boot). As expected the service starts and starts doing its designated task. I no-longer need the activity. So it goes out of sight and may not be required for a long time now.
My question is, now, if the android platform kills this activity, will it kill my service too ? (This is because I see that after few hours, my service is not running anymore.). If this is true, then will the service continue running longer if the service was started on device boot.
View 11 Replies
View Related
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
View Related
Aug 31, 2010
Android:
CODE:...........
I launched this service from activity
In activity if condition satisfies start
CODE:......................
From my location service mentioned above could not launch activity, how can i get context of current running activity in service class.
View 1 Replies
View Related
Apr 12, 2010
Is there a way to find out if an activity is bound to a service? Something like boolean isBoundToService(ServiceConnection sc)?
Sometimes when I play around with my app I get an exception when it tries to unbind a service which is not bound.
View 1 Replies
View Related
Feb 16, 2010
I have the folowing method in a Service in my appplication: Code... Do I have to do an AIDL or is there a simpler way?
View 2 Replies
View Related
Apr 9, 2009
Is it possible to get the currently running activity through Service..?
i.e. I have a service started by an Activity A, and now I want to stop the service by another activty say Activity B.
Since Activity B doesnt know about the service, i want to capture the events in OnKeyDown() of the Activity B in my service...
Is this possible.. How can i get the Activity B's object..?
View 6 Replies
View Related
Feb 22, 2009
Starting from the example ServiceStartArguments.java of the "API demos", the service "ServiceStartArguments" is creating a new Handler object (ServiceHandler) which does all the work in a separate thread. Once that work is completed, how can I tell other components that my work is finished, and also provide data (that resulted from the work) to them?
I tried something like startActivity(intent_transferred_via_msg) which does not work, I'll get an exception because I call it "outside of the service", which is technically true.
View 3 Replies
View Related