New Admob Plugin Hangs Facebook SSO on Android

Hi all,

Can you help me on a problem I am currently experiencing?

I have an app that displays admob banner and interstitial ads.  I am using the new plugin.google.play.services and the ads are working fine.

I also have Facebook for SSO (for sharing scores in the game) and this works fine on iOS, but hangs on Android.

It hangs on this line.

facebook.login(appID, listener, {“publish_actions"});

I replace this line of code below in my build.settings file:

    [“CoronaProvider.ads.admob”] =

     {

       publisherId = “com.coronalabs”,

     },

With this one:

    [“plugin.google.play.services”] =

    {

            publisherId = “com.coronalabs”

    },

If I revert the code to using CoronaProvider.ads.admob the app works fine on both platforms (but of course their are issues with using admob for both banners and interstitials, and in any event we need to use the plugin.google.play.services moving forward for admob compatibility.

It appears there is a conflict with the new google play plugin and Facebook on Android.

Any suggestions?

Thanks

If anyone has this issue, I now have a resolution to it.
 

It seems to be (very, very weird stuff) a crash of some kind if you have admob v2 activated + native.setActivityIndicator(true)+facebook.login.

If you remove the setActivityIndicator(true), facebook works.

If you remove the facebook.login but leave the indicator, the indicator works.

Put them together, app freezes (:

The fix was just to add a bit of a delay between the press of the button and the actual facebook login screen, so it’s usually needed.

So, what we tried to do was to put everything but the first Indicator(true) inside a timer.performWithDelay(100, function(), 1);

Here is the code

facebookHelper.postOnUserWall = function(message) native.setActivityIndicator(true); timer.performWithDelay(100, function() local listener; listener = function(event) if ( "session" == event.type ) then if ( "login" == event.phase ) then local postMsg = { message = message, picture = "pic url", description = "My desc", link = "link to app", name = "Name", caption = "Caption!" }; facebook.request( "me/feed", "POST", postMsg ) native.setActivityIndicator(true); end elseif ("request" == event.type) then local respTab = json.decode(event.response); native.setActivityIndicator(false); if respTab then native.showAlert("Success", "Message successfuly posted!", {"OK"}); end end native.setActivityIndicator(nil); end facebook.login(appID, listener, {"publish\_stream"}); end, 1); end

Hope this helps someone!

Cheers

Tim

Spoke to soon.

This is the code that actually works!

Notice the commented out setActivityIndicator - absolutely essential!

Hope this helps someone.

local facebook = require "facebook"; local json = require "json"; local facebookHelper = {}; local appID = \_G.facebookAPPID; facebookHelper.postOnUserWall = function(message) -- native.setActivityIndicator(true); local listener; listener = function(event) if ( "session" == event.type ) then if ( "login" == event.phase ) then local postMsg = { ["app\_id"] = appID, picture = "URL TO PICTURE", description = "DESCRIPTION TO APP", link = "LINK TO APP", name = "TITLE TEXT", caption = "CAPTION TEXT!" }; facebook.showDialog("feed", postMsg); end elseif ("request" == event.type) then local respTab = json.decode(event.response); -- native.setActivityIndicator(false); if respTab then native.showAlert("Success", "Message successfuly posted!", {"OK"}); end end -- native.setActivityIndicator(nil); end facebook.login(appID, listener); end return facebookHelper;

If anyone has this issue, I now have a resolution to it.
 

It seems to be (very, very weird stuff) a crash of some kind if you have admob v2 activated + native.setActivityIndicator(true)+facebook.login.

If you remove the setActivityIndicator(true), facebook works.

If you remove the facebook.login but leave the indicator, the indicator works.

Put them together, app freezes (:

The fix was just to add a bit of a delay between the press of the button and the actual facebook login screen, so it’s usually needed.

So, what we tried to do was to put everything but the first Indicator(true) inside a timer.performWithDelay(100, function(), 1);

Here is the code

facebookHelper.postOnUserWall = function(message) native.setActivityIndicator(true); timer.performWithDelay(100, function() local listener; listener = function(event) if ( "session" == event.type ) then if ( "login" == event.phase ) then local postMsg = { message = message, picture = "pic url", description = "My desc", link = "link to app", name = "Name", caption = "Caption!" }; facebook.request( "me/feed", "POST", postMsg ) native.setActivityIndicator(true); end elseif ("request" == event.type) then local respTab = json.decode(event.response); native.setActivityIndicator(false); if respTab then native.showAlert("Success", "Message successfuly posted!", {"OK"}); end end native.setActivityIndicator(nil); end facebook.login(appID, listener, {"publish\_stream"}); end, 1); end

Hope this helps someone!

Cheers

Tim

Spoke to soon.

This is the code that actually works!

Notice the commented out setActivityIndicator - absolutely essential!

Hope this helps someone.

local facebook = require "facebook"; local json = require "json"; local facebookHelper = {}; local appID = \_G.facebookAPPID; facebookHelper.postOnUserWall = function(message) -- native.setActivityIndicator(true); local listener; listener = function(event) if ( "session" == event.type ) then if ( "login" == event.phase ) then local postMsg = { ["app\_id"] = appID, picture = "URL TO PICTURE", description = "DESCRIPTION TO APP", link = "LINK TO APP", name = "TITLE TEXT", caption = "CAPTION TEXT!" }; facebook.showDialog("feed", postMsg); end elseif ("request" == event.type) then local respTab = json.decode(event.response); -- native.setActivityIndicator(false); if respTab then native.showAlert("Success", "Message successfuly posted!", {"OK"}); end end -- native.setActivityIndicator(nil); end facebook.login(appID, listener); end return facebookHelper;