Question about details of how services may be used.

Put your problem here if it does not fit any of the other categories.

Question about details of how services may be used.

Postby szeldon » Wed Sep 10, 2008 12:58 pm

Hi,

I'm working on an application similar to bittorrent client. Because I
want it to download things in background (even when an activity is not
visible or destroyed), I tried to use the bind/unbind scheme. But
there's a problem, because the service ends after unbinding. So I
tried to use startService(Intent), but there's no way to communicate
with that service. So, is it possible to have a background service
that lives even after activity died and has some kind of interface for
communication with it?

Thanks in advance.
szeldon
szeldon.com
szeldon
Freshman
Freshman
 
Posts: 5
Joined: Thu Feb 14, 2008 7:53 pm

Top

Postby szeldon » Wed Sep 10, 2008 5:00 pm

I'm sorry for the fact that I posted the same post on Android developers group. Zach Hobbs helped me there, so I think that it will be a good idea to put this answer also here, so that someone may find an answer for the same question.

He said that we can start service by using startService() method and then bind to it by using bindService(). After unbinding, the service is still running. Only stopService() will stop service.
szeldon.com
szeldon
Freshman
Freshman
 
Posts: 5
Joined: Thu Feb 14, 2008 7:53 pm

Postby plusminus » Wed Sep 10, 2008 6:23 pm

szeldon wrote:He said that we can start service by using startService() method and then bind to it by using bindService(). After unbinding, the service is still running. Only stopService() will stop service.

Exactly :)
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

hai

Postby dineshkm06 » Sat Sep 20, 2008 7:16 am

plusminus wrote:
szeldon wrote:He said that we can start service by using startService() method and then bind to it by using bindService(). After unbinding, the service is still running. Only stopService() will stop service.

Exactly :)


hai :D
With Regrads

Dinesh
dineshkm06
Freshman
Freshman
 
Posts: 6
Joined: Thu Jul 17, 2008 2:04 pm

Postby hamla » Mon Oct 20, 2008 9:44 am

I have a similar problem.
I have an activty that is bindin a Service. But it takes sometime before the binding is done. So I have to wait some time before I can call methods on my service via the AIDL interface. That gives me some major problems!

So what i would like to do is:
1. Start service and bindService
2. do the onServiceConnected stuff
3. The i would like to run my service methods from the activty immediatly, but i havve to wait som time before it's ready.

Is it poosible to work around this problem?
I don't want to wait sometime before I can run the methods
/Hamla
hamla
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Oct 20, 2008 9:33 am
Location: Sweden

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: TurnitinBot [Bot] and 13 guests