Skip to content

chrisribe/ti-firebase

Repository files navigation

Ti.Firebase

Appcelerator Titanium module to build and use the Google Firebase SDK 3.15.0.

How to use it:

// Firebase init
// iOS: Initialize from GoogleService-Info.plist in "Resources" (Classic) or "app/platform/ios" (Alloy) folder
var Firebase = require('ti.firebase');
Firebase.configure();

createUserWithEmail

var email = myEmailField.getValue();
var pwd = myPasswordField.getValue();

Firebase.FIRAuth.createUserWithEmail({
	email: email,
	password: pwd,
	success: function(data) {
		alert(JSON.stringify(data));
	},
	error: function(data) {
		alert(JSON.stringify(data));
	}
});

signInWithEmail

var email = myEmailField.getValue();
var pwd = myPasswordField.getValue();

Firebase.FIRAuth.signInWithEmail({
	email: email,
	password: pwd,
	success: function(data) {
		alert(JSON.stringify(data));
	},
	error: function(data) {
		alert(JSON.stringify(data));
	}
});

signOut

Firebase.FIRAuth.signOut({
	success: function(data) {	
		alert(JSON.stringify(data));
	},
	error: function(data) {
		alert(JSON.stringify(data));
	}
});

logEventWithName

Firebase.FIRAnalytics.logEventWithName({
	name: 'xyz',
	parameters: {
		'VALUE': 0.99,
		'CURRENCY': 'EUR'
	}
});

setUserPropertyString

Firebase.FIRAnalytics.setUserPropertyString({
	name: 'value_name',
	value: 'the_value'
});

projectID

Firebase.getProjectID();

Firebase Debug Mode

Firebase is setup in this module so that if you build your app in debug mode you will see debug logs from Firebase. The required argument passed on launch “-FIRAnalyticsDebugEnabled” is set in this module’s Xcode project product scheme. The scheme is set to “share” it’s settings with the project including the module.

About

Appcelerator / Titanium module project to build and use the google firebase SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published