Hello guys I reached a solution after hours and hours of research for getting data from a database to unity .It works really good on windows but not on android (i have a Plugins folder under Assets folder kindly find the attached file to see how the different Plugins were placed into the project )
and then i used the following code to read from database: on windows , it reached step 12 but on android it stops on step 6
so I guess it is going through a infinite while loop but what could cause this? Thanks for the help guys!
public void OpenDBtwo ()
{
debuggingthis.text = "step1";
Debug.Log("Call to open BD: GameDatabase.db" );
debuggingthis.text = "step2";
// check if file exists in Application.DataPath
string filepath = Application.dataPath + "/StreamingAssets/GameDatabase.db";
debuggingthis.text = "step3";
if (!File.Exists(filepath))
{
debuggingthis.text = "step14";
Debug.LogWarning("Arquive \"" + filepath + "\" doenst exist. tring to create from \"" + filepath);
// if it doesn't ->
// open StreamingAssets directory and load the db ->
debuggingthis.text = "step5";
WWW loadDB = new WWW("jar:file://" + filepath);
debuggingthis.text = "step6";
/*------reached this point on mobile-------*/
while (!loadDB.isDone) { }
// then save to Application.persistentDataPath
File.WriteAllBytes(filepath, loadDB.bytes);
debuggingthis.text = "step7";
}
debuggingthis.text = "step8";
//open db connection
connection = "URI=file:" + filepath;
debuggingthis.text = "step9";
Debug.Log("Stabilishing connection to: " + connection);
debuggingthis.text = "step10";
dbConnection = new SqliteConnection(connection);
debuggingthis.text = "step11";
dbConnection.Open();
debuggingthis.text = "step12";
}