Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Firebase Database not working anymore
Started by kakula Aug 10 2018 01:40 PM

5 replies to this topic
firebase database error message
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

kakula

[GLOBAL: userInfoPane.html]
kakula
  • Enthusiast

  • 72 posts
  • Corona SDK

Hi,

 

i had a firebase example (from corona) working months ago

 

now with new updates when you compile to apk and run on phone you get the attached error message

 

the first screen does not even load and the error message pops out

 

on simulator the first screen loads normally but as expected buttons do not work because simulator says:

"WARNING: The 'plugin.firebaseDatabase' library is not available on this platform."

 

those are the first 2 lines in main.lua which are causing the problem as i suppose

 

local firebaseDatabase = require "plugin.firebaseDatabase"
firebaseDatabase.init()

this is the whole code of main.lua

 

local firebaseDatabase = require "plugin.firebaseDatabase"
firebaseDatabase.init()




local widget = require("widget")
local json = require("json")
local bg = display.newRect( display.contentCenterX, display.contentCenterY, display.actualContentWidth, display.actualContentHeight )
bg:setFillColor( 1,.5,0 )


local title = display.newText( {text = "Firebase Database", fontSize = 30} )
title.width, title.height = 300, 168
title.x, title.y = display.contentCenterX, 168*.5
title:setFillColor(1,0,0)


local getButton
getButton = widget.newButton( {
  x = display.contentCenterX,
  y = display.contentCenterY-100,
  id = "Get Test Data",
  labelColor = { default={ 1, 1, 1 }, over={ 0, 0, 0, 0.5 } },
  label = "Get Test Data",
  onEvent = function ( e )
    if (e.phase == "ended") then
      firebaseDatabase.get("Phone_IDs/Phone_ID", 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)
    end
  end
} )
local setButton
setButton = widget.newButton( {
  x = display.contentCenterX,
  y = display.contentCenterY,
  id = "Set Hello World",
  labelColor = { default={ 1, 1, 1 }, over={ 0, 0, 0, 0.5 } },
  label = "Set Hello World",
  onEvent = function ( e )
    if (e.phase == "ended") then
        firebaseDatabase.update("Phone_IDs/Phone_ID",{GPS = "زبط"}, function (ev)
            if(ev.isError) then
                native.showAlert( "Could not Upload Data", ev.error , {"Ok"} )
            else
                native.showAlert( "Data send", "" , {"Ok"} )
            end
        end
       )
    end
  end
} )

what might be the problem

also attached simulator screen

Thanks & Regards,

Tariq

Attached Files



[TOPIC: post.html]
#2

kakula

[GLOBAL: userInfoPane.html]
kakula
  • Enthusiast

  • 72 posts
  • Corona SDK

this seems the solution to the problem but i think it is on Corona Engineers Side to Handle

 

 

https://stackoverflow.com/questions/37396973/how-to-solve-firebase-api-initialization-failure-android-firebase



[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,714 posts
  • Corona Staff

The Firebase Database plugin is provided by a third-party community developer. You should reach out to them about issues you're having with the plugin.

 

Rob



[TOPIC: post.html]
#4

kakula

[GLOBAL: userInfoPane.html]
kakula
  • Enthusiast

  • 72 posts
  • Corona SDK

Thanks Rob
 
i think i will try to work on firebase using corona directly (if applicable) if it was as easy as using network.request
after all i think it is a web service ... if it doesn't work i will create my own back end database and web services as i always did ... firebase simply gives you an opportunity to skip all back end headaches
 
the problem with android, ios, windows ...etc. is that they keep changing technology very quickly ... technology changes used to be every 3 years or more .. now every few months you might face drastic changes ... so i'd rather stick to corona team who would work immediately on major changes as i have fears of relying on third-party community developers :-) just like what happened in this case


[TOPIC: post.html]
#5

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,747 posts
  • Enterprise

This should be patched, please try rebuilding

[TOPIC: post.html]
#6

kakula

[GLOBAL: userInfoPane.html]
kakula
  • Enthusiast

  • 72 posts
  • Corona SDK

Thanks man... just tried it ...it worked just fine emoji_u1f44f.png

 
you saved me
 
I should rely on third-party community developers  :D 



[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: firebase, database, error message