AlienAsRoger / marketbilling

Automatically exported from code.google.com/p/marketbilling
0 stars 0 forks source link

Weird service interaction in Dungeons sample #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The In-App Billing sample code (Dungeons) does something really weird to 
interact with the in-application billing service.

In Dungeons.onCreate (Dungeons.java):

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

Where setContext calls the framework's AttachBaseContext.

This way of starting a service is not documented anywhere in the SDK (as far as 
I can see).

This is confusing to me as a developer. I'd like my application to only use 
documented ways of interacting with components. At the same time, I'm wary of 
changing this code because it might break the already flakey purchasing process.

Can this be cleaned up please?

One other thing: after starting and closing (with the back button) the Dungeons 
activity as attached above, the mBillingService continues to run and show in 
Phone's Running Services info screen.

This going to be a support issue for my, or anyone else's application.

Original issue reported on code.google.com by kmans...@gmail.com on 11 Apr 2011 at 7:54

Attachments:

GoogleCodeExporter commented 9 years ago
I'm also experiencing issues with the service running long after my application 
has exited. I have properly unbinded from the service similar to how its done 
in the Dungeons example.

Original comment by markus...@gmail.com on 19 Apr 2011 at 9:01

GoogleCodeExporter commented 9 years ago
I am also having trouble integrating in-apps payments. In Google I/O you told 
that it can be integrated with only one line of code but it is not.

you also told you will charge 5% of transction fee but you mention 30% on your 
website.

You should learn to make tutorials and sample codes. The is the MOST PATHETIC 
code example I have EVER SEEN IN MY LIFE.

This is really very wearied I would prefer to user PayPal rather than bogus 
in-app shit. Paypal is very much easy to integrate.  

Original comment by shah.d....@gmail.com on 30 May 2011 at 10:25

GoogleCodeExporter commented 9 years ago
@Comment 3

What you heard was about in-app-billing in the Chrome webstore!

Original comment by NicolasG...@gmail.com on 30 May 2011 at 12:17

GoogleCodeExporter commented 9 years ago
And what about using undocumented ways to start service ??? and it is not 
getting killed after game is finished ??? What the fu**in Sh*t is this ??? You 
totally disappointed devs. PayPal is much easier.

Original comment by dr.zai...@gmail.com on 30 May 2011 at 12:25

GoogleCodeExporter commented 9 years ago
Anyone found a proper way to stop the billing service?

Original comment by ran.ma...@gmail.com on 27 Aug 2011 at 4:45

GoogleCodeExporter commented 9 years ago
I gave up with this and made the service a proper service using documented code 
for starting/stopping the service.

Original comment by des...@gmail.com on 27 Aug 2011 at 5:08

GoogleCodeExporter commented 9 years ago
How do you know when to stop the service? 
I mean - how do you know if it was started from your activity or from the 
receiver?
thanks.

Original comment by ran.ma...@gmail.com on 27 Aug 2011 at 5:28

GoogleCodeExporter commented 9 years ago
The usual stopService() from the billing activity seems to work fine. There is 
a possible race condition with that, I wish startService would return the 
startId right away.

Original comment by kmans...@gmail.com on 28 Aug 2011 at 9:56

GoogleCodeExporter commented 9 years ago
There's no issue of stopping the service while it's working on a purchase?

Original comment by ran.ma...@gmail.com on 28 Aug 2011 at 9:57

GoogleCodeExporter commented 9 years ago
This weird implementation cause that exist two instation of BillingService. One 
like normal class and second like service created by system. This is also 
reason why ResponseHandler is static (this is another very ugly poart of this 
example).

Original comment by lrg....@gmail.com on 3 Sep 2011 at 11:56

GoogleCodeExporter commented 9 years ago
It seems that the lines
 mBillingService = new BillingService();
 mBillingService.setContext(this);

don't start the service.
but for example when a response code arrives to the service from the receiver, 
nothing stops the service after it.

Original comment by ran.ma...@gmail.com on 1 Oct 2011 at 10:43

GoogleCodeExporter commented 9 years ago
If taken as-is in the sample, the service and the receiver are static due to 
the way they are created (declaration in the manifest). That being said, it is 
the receiver that you should worry about as it can always wake a service even 
if it's been properly shut down. I believe a service is used for cases when the 
code in the service needs to live longer than the main activity in the 
application. The reason it is used here (Dungeons/InAppBilling) is due to 
inability to start async tasks from a receiver (note: this is no longer true as 
of 3.0, see goAsync() )

Original comment by avrazgu...@gmail.com on 15 Nov 2011 at 3:12

GoogleCodeExporter commented 9 years ago
Still open, still impacting users and generating bad feedback for Google and 
Android Market. Too bad...

Original comment by cory.tr...@gmail.com on 21 Aug 2013 at 2:46

GoogleCodeExporter commented 9 years ago
"One other thing: after starting and closing (with the back button) the 
Dungeons activity as attached above, the mBillingService continues to run and 
show in Phone's Running Services info screen.

This going to be a support issue for my, or anyone else's application."

Is there any work around or fix for this issue?

Original comment by cory.tr...@gmail.com on 21 Aug 2013 at 2:50

GoogleCodeExporter commented 9 years ago
You guys need to migrate to In-app Billing V3. It is much simpler and much more 
stable. No weird service anymore.

http://developer.android.com/google/play/billing/api.html

Original comment by beworker on 21 Aug 2013 at 4:44

GoogleCodeExporter commented 9 years ago
Google still has a lot of bugs to fix with In-App Billing v3.

For example, anyone using 'shareUserId' cannot upgrade to v3.

https://code.google.com/p/marketbilling/issues/detail?id=90

Original comment by cory.tr...@gmail.com on 21 Aug 2013 at 5:04

GoogleCodeExporter commented 9 years ago
Hello,

For the service crash after stopping I fix it by using the onStartCommand 
function instead of onStart 

and return a START_NOT_STICK flag to do not let the system restart the services 
without context.

No crash appears, but todya I have one users who did not received his purchase.

Original comment by aubrun.t...@gmail.com on 7 Oct 2013 at 1:25