Mark,

The calls to startService in BillingService are matched by stopSelf(), so that's not the cause.

I believe this long-running service is caused by how the purchase activity starts the billing service:

Dungeons.java

mBillingService = new BillingService();
mBillingService.setContext(this);

I don't see anything in the documentation to support that this is a proper way to start a service.

Bug report:

http://code.google.com/p/marketbilling/issues/detail?id=8

The call to unbindService in Dungeons.onDestroy is a bit of a red herring:

The "this" in "unbindService(this)" is BillingService.this as a ServiceConnection.

Therefore, the code unbinds the Vending service (inside Market) from the Billing service (inside the application), releasing the former, but does nothing to stop the latter.

-- Kostya

19.04.2011 22:30, markusn82 пишет:
Hi,

I recently implemented In-App billing for an application and I used
the Dungeons example as a starting point. I noticed that after leaving
my application (onDestroy is called in the base stack activity), the
BillingService service is still running on the phone and stays running
long after. I made sure that I was unbinding from the BillingService
service during onDestroy of my base activity.

As I understand it, a service that is started with startService needs
to be stopped with stopService/stopSelf, even if components bind/
unbind to it during its lifecycle (See
http://developer.android.com/guide/topics/fundamentals/bound-services.html#Lifecycle).
Does this mean that stopSelf should be called manually after calling
unbindService() or should the service stop itself automatically?

I looked further into the example code and saw that the BillingService
service was being started with startService, but stopService/stopSelf
was not being called ever. The call to stopSelf does exist in code but
it is never executed during the lifecycle of the application. Does
this indicate a bug in the example code or perhaps a bug in my usage.
I  noticed that the Dungeon example app itself also experiences the
same problem (service still running after application exited).

Any help would be appreciated.

Thanks,

Mark






--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
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