Not able to get facebook userdata in Smartface App Studio - smartface.io

I tried to implement facebook login for my app.
After success login, i am trying to get userdata by following code,
Facebook.Social.userDetails({onSuccess : function (e) {
alert(e.name);
},
onError : function () {
alert(e.message);
}
});
But, both onSuccess and onError events is not firing.
Can any one help me pls.
Thanks in advance.

Got it. :)
Should use Social.Facebook.userDetails({}) rather than Facebook.Social.userDetails({});
Thanks.

Related

Ionic 1 push notification, push.register never been fire up

I've been followed the instruction on: http://docs.ionic.io/services/push/
And I use the code below in my after login function:
$ionicPush.register().then(function(t) {
console.log(t);
return $ionicPush.saveToken(t);
}).then(function(t) {
console.log('Token saved:', t.token);
});
but it the register function with console.log never been fire up after I login.
Any idea?
Also I'm not using ionic Auth, so i didn't save the device token into user obj, and I think the auth user is not mandatory for the ionicPush, is this correct?
You can totally use Ionic Push without Ionic Auth.
Are you trying to run this code in your browser or on a device? It will only work on a device.
I suggest you to catch errors on your register() call first:
$ionicPush.register().then(function(t) {
console.log(t);
}, function(error) {
console.log(error)
});
Thus, you will see why it's not working.

How to use Timer in Smartface App Studio

I want to use Timer in my app with interval of 3secs. How to use this component. I gone through SmartfaceTimerDoc But, didn't get complete info.
Can any one help on this.
Thanks in Advance
Below is the example which initiate the function after 3 sec
var timeoutID;
function setHello() {
timeoutID = setTimeout(function () {
alert("Hello");
}, 3000);
}
function cancelHello() {
clearTimeout(timeoutID);
}

Facebook login callback not called

I'm trying to use the FB api for login on an app built with angularjs. I'm using the angular-facebook library. It works, but the issue is that once the user authorized the app, the callback is not called. So the popup window is not closed, and the only solution for the user is to reload the page. How can I fix this?
$scope.login = function() {
Facebook.login(function(response) {
// this is never called ;_;
if (response.status == 'connected') {
// I need to do stuff here
}
}, {scope: 'email,user_birthday,user_likes'});
};
IF you want more detail information on how to use AngularJS with FacebookAPI, this might be helpful:
http://www.boynux.com/angularjs-facebook-integration/
Regards,
Based on the angular-facebook documentation shouldn't your code look like this?
$scope.login = function() {
Facebook.login(function(response) {
// Do something with response. Don't forget here you are on Facebook scope so use $scope.$apply
});
};
With the Facebook.login function wrapped within a $scope.login function?

Blackberry Webworks inviteToDownload() not working

I am trying to build a BBM connected app, but unfortunately My app is not connecting to BBM and initeToDownload() is also not working. It returns the error Required argument missing
document.onload = function()
{
try {
blackberry.bbm.platform.register({
// TODO You must define your own UUID
uuid: UUID
});
} catch (e) {
alert("UUID not defined");
}
};
function inviteToDownload(){
try{
blackberry.bbm.platform.users.inviteToDownload(function(e){
alert(e);
});
}catch(e){
alert(e);
}
}
If the code above is everything you're doing to connect with BBM then you're missing a couple things.
If you take a look at the example (https://github.com/blackberry/BB10-WebWorks-Samples/blob/master/bbm/js/bbm.js) you're missing the whole 'onaccesschanged' event.
Also, make sure you have the following in your config.xml
<feature id="blackberry.bbm.platform" />
and
<rim:permissions>
<rim:permit>access_shared</rim:permit>
</rim:permissions>
Thanks everyone, I have been able to fix the problem by implementing onaccesschanged in window.onload.

shareThis click/hover events with AJAX

I am running into an issue where I am making an AJAX call to load images into a carousel, and it is breaking the shareThis click/hover events that are associated with each image (email, twitter, and facebook).
I have read all over that by doing
stButtons.locateElements();
it should resolve the issue, but it does not. Nothing happens and the buttons remain unclickable/no hover event. I have also tried reloading the script:
var switchTo5x = true;
$.getScript('//ws.sharethis.com/button/buttons.js', function () {
stLight.options({ "publisher": "publisher-code" });
});
and that just leads to button.js throwing this error: "Uncaught TypeError: Cannot call method 'process' of null".
Any thoughts on how I can rebind the events?
I ended up figuring out a solution, although there is still an error being thrown by button.js.
Before I run getScript, I set stButtons to null and that solved my issue. Here was the end result:
if (stButtons) {
// Reset the share this buttons to null
stButtons = null;
try {
// Reload the script from scratch
var switchTo5x = true;
$.getScript('//ws.sharethis.com/button/buttons.js', function () {
stLight.options({ "publisher": "pub-id" });
});
}
catch (err) { }
}
I am still getting this error from button.js: Uncaught TypeError: Cannot read property 'messageQueueInstance' of null. But, it is working now. Will look more into this error another time.