problem with Android BILLING permission

This is how my build.settings file looks under settings:

android =

        {

            versionCode = “1”,

            largeHeap = true,

            usesPermissions =

            {

                “android.permission.INTERNET”,

                “com.android.vending.CHECK_LICENSE”,

                “com.android.vending.BILLING”,

                “android.permission.GET_ACCOUNTS”,

                “android.permission.RECEIVE_BOOT_COMPLETED”,

                “com.google.android.c2dm.permission.RECEIVE”,

                “.permission.C2D_MESSAGE”,

            },

        },

below this are the plugins which include:

 [“plugin.google.iap.v3”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { android=true },

        },

I created a build and uploaded it to Google Play and it says that I need to add BILLING permissions to my APK to be able to add in-app purchases.

The build is not being corrupted. There are permissions, such as INTERNET that GP is recognizing so it isn’t failing outright.

I have a “key” listed in my config.lua file.

I can’t see an obvious reason for this problem. Can you advise what might be causing this?

Hi Mark,

Did you properly nest your “key” parameter within “config.lua” in the proper table structure, and are you 100% sure the key is active and valid within Google’s system?

Brent

I want to say “yes” to your questions and from the documentation this all seems pretty straight forward. As in, copy this code into your build.settings and that code into your config.lua and you are gtg.

However, since it isn’t working I question my own judgement. I copied and pasted the big long code from Google Play “Services and API” and pasted it in between quotes in the referenced spaces below. As a sanity check, I copied it again just now and pasted it into the file again, then selected the whole thing and did a search for it, all three instances of the string are cycled through.

I am using the older “ultimate” config.lua file and am reluctant to change it right now because some of my art assets need to be updated to make it work with the updated version. These two cases are the only ones that are used for Android by virtue of them not specifically targeting “iP” or “iPad”.

[lua]

elseif ( display.pixelHeight / display.pixelWidth > 1.72 ) then

application =

{

  content =

  {

    width = 320,

    height = 570,

    scale = “letterBox”,

    audioPlayFrequency = 22050,

    imageSuffix = 

    {

      ["@2x"] = 1.5,

      ["@4x"] = 3.0,

    },

  },

  notification = 

  {

    iphone =

    {

      types = { “badge”, “sound”, “alert” }

    },

    google =

    {

      projectNumber = “0000000000”

    },

  },

  license =

  {

    google=

    {

      key = “copied straight out of Google Play services and API and surrounded by quotes”,

      policy = “serverManaged”,

    },

  },

}

else

application =

{

content =

{

width = 320,

height = 512,

–scale = “letterBox”,

audioPlayFrequency = 22050,

imageSuffix =

{

["@2x"] = 1.5,

["@4x"] = 3.0,

},

},

notification = 

   {

       iphone =

       {

           types = { “badge”, “sound”, “alert” }

       },

       google =

       {

           projectNumber = “0000000000”

       },

   },

   license =

   {

    google=

    {

    key = “copied straight out of Google Play services and API and surrounded by quotes”,

    policy = “serverManaged”,

   },

},

}

end

[/lua]

Hi Mark,

Did you follow through the entire IAP guide?

http://docs.coronalabs.com/guide/monetization/IAP/index.html

Do you think this conditional format is incompatible with Google Play?

I don’t really know how the file is interpreted by their server to decide if the key is there. I am guessing it is just using the “else” case.

Do I need to escape any characters in my key string?

Hi Mark,

I don’t think it should cause any issues, unless for some reason your conditional logic block is not being detected. Why not just include the licensing thing in all possible conditions (meaning, outside of the blocks)? It would just be ignored for iOS builds, and then you know for sure that it’s getting into the Google side of things.

“Next, you must build your app — even if it’s still in development — to create a .apk file which can be uploaded to the Google Play Developer Console. Once it’s uploaded, you must activate it, but do not publish it yet!”

This is the only thing I haven’t done. I don’t know how to “activate” my build… I’m uploading it as an alpha and it tells me that I can only have one so… I’m guessing this instruction is deprecated?

I’m going to try moving it out of the conditionals.

Sigh… I’m a dummy.

I figured out that the problem was that my android permissions were inside the iPhone bracket in my build.settings. Basically, I miscounted my closed brackets.

For the record, it didn’t make any difference whether the key was in the brackets or out.

Thank you for trying to help.

Good to hear! And yes, thus is the severe danger of “copy and paste code block X”, especially in build.settings or config.lua. :slight_smile:

Brent

Hi Mark,

Did you properly nest your “key” parameter within “config.lua” in the proper table structure, and are you 100% sure the key is active and valid within Google’s system?

Brent

I want to say “yes” to your questions and from the documentation this all seems pretty straight forward. As in, copy this code into your build.settings and that code into your config.lua and you are gtg.

However, since it isn’t working I question my own judgement. I copied and pasted the big long code from Google Play “Services and API” and pasted it in between quotes in the referenced spaces below. As a sanity check, I copied it again just now and pasted it into the file again, then selected the whole thing and did a search for it, all three instances of the string are cycled through.

I am using the older “ultimate” config.lua file and am reluctant to change it right now because some of my art assets need to be updated to make it work with the updated version. These two cases are the only ones that are used for Android by virtue of them not specifically targeting “iP” or “iPad”.

[lua]

elseif ( display.pixelHeight / display.pixelWidth > 1.72 ) then

application =

{

  content =

  {

    width = 320,

    height = 570,

    scale = “letterBox”,

    audioPlayFrequency = 22050,

    imageSuffix = 

    {

      ["@2x"] = 1.5,

      ["@4x"] = 3.0,

    },

  },

  notification = 

  {

    iphone =

    {

      types = { “badge”, “sound”, “alert” }

    },

    google =

    {

      projectNumber = “0000000000”

    },

  },

  license =

  {

    google=

    {

      key = “copied straight out of Google Play services and API and surrounded by quotes”,

      policy = “serverManaged”,

    },

  },

}

else

application =

{

content =

{

width = 320,

height = 512,

–scale = “letterBox”,

audioPlayFrequency = 22050,

imageSuffix =

{

["@2x"] = 1.5,

["@4x"] = 3.0,

},

},

notification = 

   {

       iphone =

       {

           types = { “badge”, “sound”, “alert” }

       },

       google =

       {

           projectNumber = “0000000000”

       },

   },

   license =

   {

    google=

    {

    key = “copied straight out of Google Play services and API and surrounded by quotes”,

    policy = “serverManaged”,

   },

},

}

end

[/lua]

Hi Mark,

Did you follow through the entire IAP guide?

http://docs.coronalabs.com/guide/monetization/IAP/index.html

Do you think this conditional format is incompatible with Google Play?

I don’t really know how the file is interpreted by their server to decide if the key is there. I am guessing it is just using the “else” case.

Do I need to escape any characters in my key string?

Hi Mark,

I don’t think it should cause any issues, unless for some reason your conditional logic block is not being detected. Why not just include the licensing thing in all possible conditions (meaning, outside of the blocks)? It would just be ignored for iOS builds, and then you know for sure that it’s getting into the Google side of things.

“Next, you must build your app — even if it’s still in development — to create a .apk file which can be uploaded to the Google Play Developer Console. Once it’s uploaded, you must activate it, but do not publish it yet!”

This is the only thing I haven’t done. I don’t know how to “activate” my build… I’m uploading it as an alpha and it tells me that I can only have one so… I’m guessing this instruction is deprecated?

I’m going to try moving it out of the conditionals.

Sigh… I’m a dummy.

I figured out that the problem was that my android permissions were inside the iPhone bracket in my build.settings. Basically, I miscounted my closed brackets.

For the record, it didn’t make any difference whether the key was in the brackets or out.

Thank you for trying to help.

Good to hear! And yes, thus is the severe danger of “copy and paste code block X”, especially in build.settings or config.lua. :slight_smile:

Brent