Android的账单 - 我应该实现ServiceConnection或IMarketBillingService账单、Android、IMarketBillingService、ServiceCon

2023-09-05 00:44:47 作者:絕吥放棄々

我在看Android的应用内结算的教程:

I am looking at the Android in-app billing tutorial here:

http://developer.android.com/guide/google/播放/计费/ billing_integrate.html

和他们的指令来实现iMarketBillingService。但是,我在另一个例子中,该ServiceConnection法实施所看到的。

and they have an instruction to implement the iMarketBillingService. But I saw in another example that the ServiceConnection method was implemented.

哪一个应该是什么?

我有困惑,因为我试图做这样的事情:

I am having confusion because I am trying to do something like this:

            Bundle request = makeRequestBundle("CHECK_BILLING_SUPPORTED");
            Bundle response = mService.sendBillingRequest(request);

但不知道什么MSERVICE变量应该是。在从Andoroid土牢教程,他们有这样的:私人BillingService有mBillingService;

但是当我尝试这样做:

Bundle response = mBillingService.sendBillingRequest(request);

我得到一个语法错误说,该方法sendBillingRequest是未定义BillingService有。

I get a syntax error saying that the method sendBillingRequest is undefined for BillingService.

所以基本上我越来越困惑我的不同的服务和接口,我需要与合作。请帮助我了解什么是正确的做法对我来说。

So essentially I am getting confused in my different services and interfaces that I need to be working with. Please help me understand what is the correct approach for me.

感谢您!

推荐答案

我知道痛。我发现安卓inapp计费SDK更复杂的比它应该是。坦白说,我只是不明白,为什么它需要如此复杂。为了缓解出来,我基本上是用一个简单的HelloWorld的inapp计费。搞不定,跑我登录,然后开始担心我的逻辑。这就像驾驶在倒车档,但为了节省时间,精力我使用这种技术复杂的SDK。

I know the pain. I have found android inapp billing sdk more complex than it should be. Frankly I just dont get it, why does it need to be so complex. To ease it out, I basically use a simple helloworld for inapp billing. Get it working, running for my login and then start worrying about my logic. This is like driving in the reverse gear, but to save time, effort I use this technique for complex sdk.

我得到的HelloWorld的工作,并保持这个作为一个单独的项目。这有助于调试后,当我进入升级或其他一些问题。这个集成到我的项目只是玩弄火。)

I get the helloworld working, and keep this as a separate project. This helps debugging later when I get into upgrade or some other issues. Integrating this into my project is just messing with fire :).

我有一个HelloWorld压缩在那里为您下载和尝试。希望它能帮助。 集成在应用程序内结算,在短短3行code

I have a helloworld zip out there for you to download and try. Hope it helps. Integrate In App Billing in just 3 lines of code