Difficulty with Android IMarketBillingService

Hello,

I’ve been trying to get in app purchasing on Android up and running and I’m running into a wall with the IMarketBillingService.aidl file supplied by Google. I can’t get this file to auto generate a .java using Ant. (note: this part is solved, see Update & Update 2).

I tried using the .java file from the sample project supplied but I’m having difficulty importing it into my project to use. I got it working by changing the package name but that won’t work as it must have the package name com.android.vending.billing otherwise you get a security exception when trying to use it.

Can anyone who has implemented Android in app purchasing with Unity offer some advice?

Thanks.

UPDATE:

The problem is almost certainly in the build.xml. I’ve implemented the Openfeint plugin so my build.xml is the same as the one that came with that. I can see how the original bild.xml in the sdk mentions .aidl files so I just need to modify my own to work.

I’ve added:

<property name="android.platform.tools.dir" location="${sdk.dir}/platform-tools" />
<property name="aidl" location="${android.platform.tools.dir}/aidl.exe" />

<target name="-code-gen">
        <echo>----------</echo>
        <echo>Handling aidl files...</echo>
        <aidl executable="${aidl}" framework="${android.aidl}"
                genFolder="${gen.absolute.dir}">
            <source path="${source.absolute.dir}"/>
        </aidl>
</target>

But I’m not getting the error
aidl: Cant’ open preprocessed file: […]Assets/Plugins/Android/${android.aidl}

You should take a look at an open source project - http://project.soom.la. It’s an in-app billing library for Android. You can either use the code as reference or you can just take the whole thing and use as a billing SDK. It makes Android billing, simple and more secure and it also has a sample app for reference.

So I got in a state where everything compiles and I can now progress, although I’m not very happy with the solution.

I couldn’t import any .java files from /Assets/Plugins/Android/gen/. (for some reason, I’m not sure why as I can perfectly fine in other non-unity projects) so I’ve had to change the build.xml to place the generated .java file in my source folder instead.