Android In-App Purchase. KIVY IS AWESOME!

153 views
Skip to first unread message

Ish Rash

unread,
Nov 15, 2017, 5:51:03 AM11/15/17
to Kivy users support
I used the Python-for-Android billing example to implement in-app purchases on my kivy game but the app fails on start up.
I changed line 10 of the code to 
self.service = BillingService(self.billing_callback)
because I got a "global billingservice not found" error. 

Second error:
11-15 04:07:33.499 18265 18283 I python  : [INFO              ] [Support     ] Android install hooks
11-15 04:07:33.502 18265 18283 I python  : [INFO              ] [Window      ] virtual keyboard not allowed, single mode, not docked
11-15 04:07:33.533 18265 18283 I python  : [INFO              ] [Text        ] Provider: pygame
11-15 04:07:33.852 18265 18283 I python  : [INFO              ] [Audio       ] Providers: audio_pygame (audio_pygst, audio_ffpyplayer ignored)
11-15 04:07:38.163 18265 18283 I python  : [INFO              ] [GL          ] NPOT texture support is available
11-15 04:07:45.247 18265 18283 D ResponseHandler: @@@@@@@@@22 RESPONSE HANDLER CALLED REGISTER()
11-15 04:07:45.290 18265 18283 W ContextImpl: Implicit intents with startService are not safe: Intent { act=com.android.vending.billing.MarketBillingService.BIND } android.content.ContextWrapper.bindService:604 android.content.ContextWrapper.bindService:604 org.renpy.android.billing.BillingService.bindToMarketBillingService:464
11-15 04:07:45.292   345  1177 W ActivityManager: Unable to start service Intent { act=com.android.vending.billing.MarketBillingService.BIND } U=0: not found
11-15 04:07:45.292 18265 18283 E BillingService: Could not bind to service.
11-15 04:07:45.292 18265 18283 W Python  : NO BILLING SUPPORTED
11-15 04:07:45.293 18265 18283 W ContextImpl: Implicit intents with startService are not safe: Intent { act=com.android.vending.billing.MarketBillingService.BIND } android.content.ContextWrapper.bindService:604 android.content.ContextWrapper.bindService:604 org.renpy.android.billing.BillingService.bindToMarketBillingService:464
11-15 04:07:45.294   345  3908 W ActivityManager: Unable to start service Intent { act=com.android.vending.billing.MarketBillingService.BIND } U=0: not found
11-15 04:07:45.294 18265 18283 E BillingService: Could not bind to service.
11-15 04:07:45.294 18265 18283 W Python  : NO SUBSCRIPTION SUPPORTED
11-15 04:07:45.310 18265 18283 I AdBuddiz: cacheAds
11-15 04:07:46.019 18265 18275 I art     : Background sticky concurrent mark sweep GC freed 23273(1163KB) AllocSpace objects, 4(80KB) LOS objects, 17% free, 5MB/7MB, paused 32.331ms total 150.939ms
11-15 04:07:46.741 18265 18283 I python  : [WARNING           ] Call to deprecated function __call__ in /home/kivy/Desktop/pong/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/utils.py line 251.Called from /home/kivy/Desktop/pong/.buildozer/android/app/main.py line 3711 by post_build_init().
11-15 04:07:46.750 18265 18265 W System  : ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/00000020/n/armeabi-v7a
11-15 04:07:46.752 18265 18265 W System  : ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/00000020/n/armeabi
11-15 04:07:46.860 18265 18283 I python  : [INFO              ] [OSC         ] using <thread> for socket
11-15 04:07:46.877 18265 18283 I python  : [INFO              ] [Base        ] Start application main loop
11-15 04:07:46.887 18265 18265 D DynamitePackage: Instantiated singleton DynamitePackage.
11-15 04:07:46.888 18265 18265 D DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl


Any help will be appreciated. Thank you.


Ish Rash

unread,
Nov 15, 2017, 6:03:01 AM11/15/17
to Kivy users support
These are the only changes I made to the code:
def billing_callback(self, action, *largs):
    '''Callback that will receive all the events from the Billing service
    '''
    if action == BillingService.BILLING_ACTION_ITEMSCHANGED:
        items = largs[0]
        if 'coin' or 'gem' in items:
            print "Congratulations, you have a premium acess"
            toast('Congratulations', False)
        else:
            print "Unfortunately, you don't have premium access"
            toast('Error, try again', False)

def buy_coin(self, *args):
    self.bs.buy('coin')
    #print bs.get_purchased_items()
   # {'org.kivy.gopremium': {'qt: 1}}

def buy_gem(self, *args):
    self.bs.buy('gem')
    #print bs.get_purchased_items()
   # {'org.kivy.gopremium': {'qt: 1}}


 

Gabriel Nobrega

unread,
Dec 11, 2017, 9:43:31 AM12/11/17
to Kivy users support
Did you manage to get it working?
Looking for a solution aswell.
Reply all
Reply to author
Forward
0 new messages