Hi all,
Trying to get database working with this plugin. I have login abilities working, and I am able to create users and delete and what not.
However, when it comes to working with Firebase RealTimeDB, I cannot get it to interact at all.
I have followed all steps and go as far as removing my code and using the demo code and linking it to my database, however no luck.
I will "run init", and will get a success message, however when I go to push or query the database, I get a "Error: run init" message.
I have attached code for reference, please let me know if you need anything else.
Kind Regards,
Harrison
`var observableModule = require("data/observable");
var dialogs = require("ui/dialogs");
var utils = require("utils/utils");
var fs = require("file-system");
var firebase = require("nativescript-plugin-firebase");
const firebaseWebApi = require("nativescript-plugin-firebase/app");
var platform = require("platform");
function econtactFrmViewModel() {
var viewModel = observableModule.fromObject({
});
viewModel.registerUser = function () {
firebase.push(
'/users',
{
'first': 'Eddy',
'last': 'Verbruggen',
'birthYear': 1977,
'isMale': true,
'address': {
'street': 'foostreet',
'number': 123
}
}
).then(
function (result) {
dialogs.alert({
title: "Working",
message: result.key,
okButtonText: "OK"
});
},
function (error) {
dialogs.alert({
title: "Login error",
message: error,
okButtonText: "OK, pity"
});
}
);
};
return viewModel;
}
module.exports = econtactFrmViewModel;`
`/*
In NativeScript, the app.js file is the entry point to your application.
You can use this file to perform app-level initialization, but the primary
purpose of the file is to pass control to the app鈥檚 first module.
*/
require("./bundle-config");
const application = require("application");
const firebase = require("nativescript-plugin-firebase/app");
firebase.init({
// Optionally pass in properties for database, authentication and cloud messaging,
// see their respective docs.
persist: true
}).then(function (instance) {
console.log("firebase.init done");
}, function (error) {
console.log("firebase.init error: " + error);
});
application.run({ moduleName: "app-root" });
/*
Do not place any code after the application has been started as it will not
be executed on iOS.
*/
`
This is the app.js file of the application
This is a view-model.js file for the form I am trying to load the database
Attached files for easy reading, having issues with code embedding
Please just share the project.
Will do, just need to remove some files and resources due to IP.
@EddyVerbruggen
https://github.com/devteam8BT/firebaseTemplate-8bt
That is the link for the repo, I had to hack quite a bit out, however if I can simply get a form working and talking to the database, the team will be able to replicate.
However, we attempted to compile, and it did, however its now throwing an error regarding
"A valid Facebook app id must be set in the AndroidManifest.xml"
However, Facebook Authentication has been deselected in config.
So if I clone the repo, does it work? Which steps do I take to reproduce the issue?
If you clone the repo, it should compile and emulate, however once running, it now throws an issue regarding the "Valid Facebook App ID".
This is a new issue, re-doing the code strip now to see if the team can rectify it.
@devteam8BT did you find a fix for the issue? If you do can you share with us? I am having the same issue here.
Most helpful comment
@devteam8BT did you find a fix for the issue? If you do can you share with us? I am having the same issue here.