Search code examples
apikivybillingbuildozer

kivy - Buildozer: in-app billing (Google android)


Has any one successful used Google's in-app builling for a kivy/buildozer created app? If so, can you give me the run down on how to install and use the APIs under a linux ubuntu system?


Solution

  • Using buildozer, you add your public key to your bashrc file as:

               export BILLING_PUBKEY="your public key goes here in the bashrc"
    

    When building the apk with buildozer, you pass the billing argument with the public key token:

               buildozer --with-billing $BILLING_PUBKEY android debug (or release)
    

    You can then use a tool like apktool to decompile your apk, exposing the manifest.xml. You want to add the billing permission to the manifest:

               <uses-permission android:name="com.android.vending.BILLING" />
    

    Then use apktool to recompile the apk. Inside your main.py you should import billing as:

               from android.billing import BillingService
    

    Lastly, you have to sign and zipalign your apk (again if done before).

    In-app billing should now be enabled for your app. When installing the apk, you will see network communications billing as one of the app's permissions.

    There is code at github which uses in-app billing but I'm not sure if that code is reliable.