I am writing my first plugin in Unity. As part of the plugin(i.e in Android studio) i am supposed to connect to database using a Async thread class. Exported it as Jar and imported in Unity . back in unity i need to hold my function calls until connected with Database. So how can i perform that.
Code in Android Studio
public class AndroidToDatabase extends
AsyncTask{
private String URLresponse;
@Override
protected String doInBackground(String… uri)
{
return URLResponse
}
I tried using a check with URLresponse at Unity Side
Unity Code :
IEnumerator Initilize() {
yield return StartCoroutine(getURLResponse()); }IEnumerator getURLResponse() {
pluginClass.Call (“Init”);
//Android Studio Function Which executes my Async thread i.e AndroidToDatabase class
string response= pluginClass.Callstring;
// Returns the URL response from Android Studio
}
always returns Null. please help me get through this.