B4J Tutorial Google Play Developer API

Discussion in 'B4J Tutorials' started by Erel, Jul 19, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Google Play Developer API allows you to access your developer account and do all kinds of things. For example get the latest app reviews or check the status of in-app purchases.

    Like with all other Google services, we will use GoogleOAuth2 class for authentication: https://www.b4x.com/android/forum/threads/79426/#content

    This example is made of two projects:

    1. A UI project that is used for the first authentication. Note that it doesn't show any form.
    2. A server project that uses the token created in the first step to access the inventory API. The inventory API is just used as an example. It should be simple to change it to other APIs.

    - The first step is to link a project in Google Play developer console:

    [​IMG]

    In this project you need to create new credentials (type = other).
    You need to get the client id and client secret.

    Make sure that Google Play Android Developer API is enabled.

    - Update ClientId and ClientSecret globals in the two projects.
    - Update the package in the code and run it. The browser will open and you will be asked to authorize the app to access your developer account.
    - If all goes well you will see a list of the available in-app products.
    This will also create the token file that will be used by the server app

    - Run the server app and test it with:
    http://127.0.0.1:51042/inventory?package=your.package.here

    You should see the json response:

    [​IMG]
     

    Attached Files:

    Kiffi, arastoo, johndb and 4 others like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice