Hi,
I’m using firebase on a certain project (V3).
I use this plugin: firebase plugin.
FCM and Database (Using angularfire) works (though I wasn’t able to send push notifications to devices, tested on iOS)
when I use this code:
this.url = "";
console.log("before getValue()");
this.firebase.getValue("info_url").then(url => {
console.log("during getValue()");
this.url = url;
console.log(this.url);
}).catch(error => {
console.log(error);
});
console.log("after getValue()");
console prints:
before getValue()
after getValue()
and I don’t get any URL.
EDIT:
In app.component.ts I also want to call inside this.platform.ready().then() one of those functions. Which one should I use?
getWindowConfig() {
(<any>window).FirebasePlugin.fetch(600, result => {
// activate the fetched remote config
console.log(JSON.stringify(result)); //Always "OK"
(<any>window).FirebasePlugin.activateFetched(
// Android seems to return error always, so we want to cath both
result => {
console.log(JSON.stringify(result)); //either true or false
(<any>window).FirebasePlugin.getValue("info_url", result => {
console.log(result)
}, reason => {
console.warn(`Error ${reason}`);
});
}, reason => {
console.warn(reason);
}
)
});
}
async getConfigValues() {
if (this.platform.is('android')) {
var defaults = {
support_email: "<default>",
nanobyte_email: "<default>",
kilobyte_email: "<default>",
megabyte_email: "<default>",
gigabyte_email: "<default>",
hadassah_email: "<default>",
service_email: "<default>",
info_url: "<default>",
schedule_url: "<default>"
}
await this.firebase.setDefaults(defaults);
}
await this.firebase.fetch();
this.firebase.activateFetched();
}
I would love to get suggestions.
Thank you for answers.
Amit