Hi scott,
I am using the firebaseDatabase plugin & I am able to fetch the data from DB unless I add the array in DB.
please refer the below screenshot.
I tried but the apk getting crash in runtime.
Json** Data on Firebase DB :**
[lua]
{
“menu” : {
“answer” : “4”,
“categories” : “science”,
“city” : “New York”,
“lala” : “tiger”,
“name” : “John”,
“option01” : “1”,
“option02” : “2”,
“option03” : “3”,
“option04” : “4”,
“questions” : “Earth”,
“results” : [ {
“quiz” : “sci”
}, {
“quiz” : “math”
}, {
“quiz” : “gk”
} ]
}
}
[/lua]
Lua Sample Code:
[lua]
firebaseDatabase.get(“menu”, function (ev)
if(ev.isError) then
native.showAlert( “Could not Get Data”, ev.error , {“Ok”} )
else
native.showAlert( “Data received”, json.encode( ev.data ) , {“Ok”} )
end
end)
[/lua]
APK crash Log:
12-18 17:08:21.197 6703-6703/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.bizzcodestudios.gksuccess, PID: 6703
com.naef.jnlua.LuaRuntimeException: attempt to index a function value
at com.naef.jnlua.LuaState.lua_setfield(Native Method)
at com.naef.jnlua.LuaState.setField(Unknown Source)
at plugin.firebaseDatabase.LuaLoader$get$1.onDataChange(LuaLoader.java:532)
at com.google.firebase.database.Query$1.onDataChange(Unknown Source)
at com.google.android.gms.internal.zzajp.zza(Unknown Source)
at com.google.android.gms.internal.zzakp.zzcxi(Unknown Source)
at com.google.android.gms.internal.zzaks$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:218)
at android.app.ActivityThread.main(ActivityThread.java:5657)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:990)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:785)