Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Notifications;
- var Cloud = require('ti.cloud');
- (function() {
- Notifications = function() {
- Ti.API.info('Notifications ...');
- var _registerDevice = function() {
- Ti.API.info('RegisterDevice');
- }
- return {
- cloudUserLogin : function() {
- //_registerDevice(_token);//_token is being populated in app.js for now
- Ti.API.info(' >>>>>>>> calling login - oOk');
- //Cloud.debug = true;
- Cloud.Users.login({
- login : "push123",
- password : "push123"
- }, function(e) {
- if (e.success) {
- var user = e.users[0];
- Ti.API.info('Logged in! Registering to channel as user =' + user.id);
- } else {
- Ti.API.info('error loggin in - ' + e);
- }
- });
- //loginUser("push123", "push123");
- },
- registerDevice : function() {
- //ios only function
- if (Ti.Platform.osname == "iphone") {
- Ti.API.info(' Im iOS!');
- Notifications.cloudUserLogin();
- } else {
- Ti.API.info('Im Android');
- Notifications.cloudUserLogin();
- }
- }
- }
- }();
- //OF.Util.Notifications
- })();
Add Comment
Please, Sign In to add comment