Wednesday, October 31, 2012

[android-developers] Using Service without startService(), bindService()?

I'm looking at the In-app Billing example and found something interesting.
(http://developer.android.com/guide/google/play/billing/billing_integrate.html#billing-download)

I have known that Service must be started with startService() or bindService(),
but in the example BillingService is made by BillingService() constructor which I've never seen before.

In the BillingService.java I found the comment "on behalf of the application" and attachBaseContext().
I guess maybe this is the reason? (I don't fully understand what attachBaseContext() does, but the name tells me.)
Please give me some explanation.

BTW, is using Service() constructor permitted / encouraged by any means?
This seems to me like   Activity myActivity = new MyActivity() :(

--
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, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate