分享FB.ui功能如何捕捉关闭事件电话差距应用程序

Share FB.ui function how to catch close event phonegap app

本文关键字:事件 电话 差距 应用程序 何捕捉 FB ui 功能 分享      更新时间:2023-09-26

当我显示FB共享窗口时,我想知道用户是否按下了关闭按钮,有没有办法做到这一点?

 var share = function shareInTimeLine(actionTypeName, bookTitle, bookImage, bookLocation,callback)
        {
            var deferred = $q.defer();
            if(typeof(FB) != 'undefined')
            {
                // calling the API ...
                var obj = {
                    method: 'feed',
                    link: 'http://www.bookcrossingapp.com/',
                    picture: bookImage,
                    name: bookTitle + ' was ' + actionTypeName,
                    caption: 'In ' + bookLocation,
                    description: bookTitle + ' was ' + actionTypeName + ' in BookCrossing app'
                };
                FB.ui(obj, function(response){
                    if(response != undefined)
                    {
                        $rootScope.$apply(function () {
                        deferred.resolve(response);
                        });
                    }
                    else
                    {
                        alert("X pressed");
                        $rootScope.$apply(function () {
                            deferred.reject(ErrorConst.GenericError);
                        });
                    }
                });
            }
            else
            {
                deferred.resolve();
            }
            return deferred.promise;
        }

试试这个:

$FB.ui(obj).then(function(response) {
    if(response != undefined){
        //Real response
        alert("Somebody set us up the bomb!");
    }else{
        //Window closed
        alert("All your base are belong to us!");
    }
});