A
A
Alexey_Bespaly2013-09-16 15:55:41
Android
Alexey_Bespaly, 2013-09-16 15:55:41

Unity plugin for android with asynchronous callback?

Is there somewhere an example of a Unity plugin implementation with an asynchronous callback? And is it even possible to do this?
The unity site has examples of plugins. But adding two numbers in C++ and getting the answer right away is much easier than getting the answer asynchronously.
At the same time, the plugin itself can be implemented both in .jar and .so (C ++) - both options will be convenient.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
romeo_ordos, 2013-09-16
@Alexey_Bespaly

You can try to figure it out using the example of my plugin for IAB .
The InAppBilling.cs class refers to the Java class IabPlugin.java . And from there, after a while, the callback back to C #.
There:

void queryInventoryAsync(bool querySkuDetails, string[] sku_array)
{
 #if(UNITY_ANDROID && !UNITY_EDITOR)
 iab.Call("queryInventoryAsync", querySkuDetails, sku_array);
 #endif
}

Back:
UnityPlayer.UnitySendMessage(IabPlugin.this.gameObject, "OnQueryInventoryComplete", result.getMessage());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question