Answer the question
In order to leave comments, you need to log in
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
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
}
UnityPlayer.UnitySendMessage(IabPlugin.this.gameObject, "OnQueryInventoryComplete", result.getMessage());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question