Dear all,
My app has an activity A and i want to create MyService which can run
in background indefinitely. So from activity A, i call start myservice
as following:
Intent intent = new Intent(getBaseContext(), MyService.class);
startService(intent);

I also want to pass data object from Activity A to MyService during
the running time of myservice, so i bind Activity A to MyService as
below :
bindService(new Intent(ActivityA.this, MyService.class), mConnection,
0);
with mConnection = new ServiceConnection() {
        public void onServiceConnected(ComponentName className,
IBinder service) {
     //get binder and send data to myservice
}
In onStop event of Activity A i call unbindService to my service and
call bindService in onStart event.
MyService work well after 3days. i let my android phone run during
3days to test myservice without turning my phone off.
But i got problem with myservice after 3days. myservice still run in
background. i knew this because i saw myservice in list of services
return from ActivityManager.getRunningServices(Integer.MAX_VALUE). But
the problem is that Activity A cannot bind to MyService anymore. i
cannot bind Activity A to MyService and i cannot pass data from
Activity to service as well.

Activity A can only bind to MySerice by calling startService(new
Intent(getBaseContext(), MyService.class)) again.
So what wrong with myservice? it's still running in background but
Activity A cannot bind to it. i dont want to call startService() again
because this is an indefinite service. Assuming that i have to call
startService() again, i dont even know that when and where i will call
startService() again.

Please, android developers are working on android core at google
please help me explain this and show me the way to solve this problem.
Thanks all you so much.



-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to