I'm using EddyVerbruggen's NativeScript firebase plugin - https://github.com/EddyVerbruggen/nativescript-plugin-firebase
Firebase has been configured properly. I ran the following code & it's working fine.
firebase.init(<any>{
persist: true, // Allow disk persistence. Default false.
url: config.apiUrl
}).then(
function (instance) {
console.log("firebase.init done");
},
function (error) {
console.log("firebase.init error: " + error);
}
);
But, when I'm trying to create user through email id & password by using following code
firebase.createUser({
email: 'eddyverbruggen@gmail.com',
password: 'firebase'
}).then(
function (result) {
// dialogs.alert({
// title: "User created",
// message: "userid: " + result.key,
// okButtonText: "Nice!"
// })
alert('User Created with user id - '+result.key);
},
function (errorMessage) {
// dialogs.alert({
// title: "No user created",
// message: errorMessage,
// okButtonText: "OK, got it"
// })
alert('No user created. Got error message insted - '+errorMessage);
}
)
I'm getting message from my console like this -
JS: --- auth state changed: com.google.android.gms.internal.zzadg@399fbe6
The main parent file is -
import {Injectable} from "@angular/core";
import {User} from "./user";
import {ConfigService} from "../config";
import firebase = require("nativescript-plugin-firebase");
@Injectable()
export class UserService {
register(user: User,config:ConfigService) {
alert("API url going to use is : "+config.apiUrl);
firebase.init(<any>{
persist: true, // Allow disk persistence. Default false.
url: config.apiUrl
}).then(
function (instance) {
console.log("firebase.init done");
},
function (error) {
console.log("firebase.init error: " + error);
}
);
firebase.createUser({
email: 'eddyverbruggen@gmail.com',
password: 'firebase'
}).then(
function (result) {
// dialogs.alert({
// title: "User created",
// message: "userid: " + result.key,
// okButtonText: "Nice!"
// })
alert('User Created with user id - '+result.key);
},
function (errorMessage) {
// dialogs.alert({
// title: "No user created",
// message: errorMessage,
// okButtonText: "OK, got it"
// })
alert('No user created. Got error message insted - '+errorMessage);
}
)
}
}
when in checking in my firebase app account user account also not reflecting.
I know, there is a small mistake, because of which it's not working. But, can't able to figure out what causing the problem.
-------Error Fixed-------
Whole time I was testign in an Emulator which has no Google Play Service installed. It required Google Play Service to work. Finally, when I tested this in my mobile device it's worked fine.