How can I implement Google Play Billing if I can't use onActivityResult?

So as I’ve been stumbling around trying to figure out why billing doesn’t work, I’ve figured out that Unity plugins never receive the onActivityResult calls after launching an activity. The Google Play billing API seems to require that though. Sistema di fatturazione di Google Play  |  Google Play's billing system  |  Android Developers

After you call startIntentSenderForResult, you have to catch the response in onActivityResult. The billing sample with a wrapper also uses the same method, where after you call startPurchaseFlow, you have to catch the response with handleActivityResult.

Is there any way to get this to work in Unity?

Never mind, I finally figured out how to get onActivityResult to work. The Unity docs could probably stand to be a little bit clearer.

Hi Makeshiftwings, how did you resolve the problem, do you remember?

If I recall, you need to do everything through “listeners”; create a class that inherits AndroidJavaProxy ( Unity - Scripting API: AndroidJavaProxy ) and have it implement the methods you need like onPurchaseSucceeded, and you pass the listener class as a parameter when using Call on the java object. Unfortunately I don’t have the code with me but I think there are some tutorials out there somewhere.