Is facebook connect and flurry analytics working for Android?

Hello,

I was using build 503 for creating android app.

However, I found facebook connect and flurry analytics was not working. Is that true? do I miss something?

My app is going to submit to an app contest in Taiwan. The deadline is 2011-05-15. I have an iOS version submit to apple 2011-05-02 but still in review till now. I want to lunch android version today. (I wish the facebook and the analytic function can work somehow?)

Bob

Application Name: ???
Application Version Number: 1.0
Application SKU: Republic of Apples
Application Apple ID:435494274

[import]uid: 20999 topic_id: 9977 reply_id: 309977[/import]

As far as I know both should be supported on Android…

If you haven’t yet, try to add following to your build.settings
androidPermissions =
{
“android.permission.INTERNET”
},
I hope this helps…

E. [import]uid: 10478 topic_id: 9977 reply_id: 36431[/import]

http://developer.anscamobile.com/reference/index/facebooklogin

chk out at the last :-
you will find answer for each api like this

Supported on operating systems and platforms for build numbers shown:

Mac OS X:

Windows:

iOS:
Build 2010.243
Android:
Build 2011.334 [import]uid: 12482 topic_id: 9977 reply_id: 36441[/import]

Hi, hgvyas123 & PixelEnvisio

Thank you for giving me the informations.

I try to change my build.settings BUT no luck

The facebook connect is not working

I was using Galaxy S with OS 2.3.4 and CORONA build 484 and 503

same code was OK on iOS but fail on Android build.

However, I found Flurry Analytic is GOOD.
Only facebook connect has problem.

Did you guys really try the facebook connect on your device?

BOB [import]uid: 20999 topic_id: 9977 reply_id: 36557[/import]

What problem are you seeing with Facebook? I rechecked the Facebook sample app on the Nexus One and it I’m able to post messages and photos but it does a double posting. We’ve had reports that it’s not working on some devices (e.g., Droid) and trying to understand where it does and doesn’t work.

Thanks,
Tom [import]uid: 7559 topic_id: 9977 reply_id: 36675[/import]

Hi, Tom

Thank you for your reply.

The device I used was Nexus S with Android 2.3.4 (GRJ22)

When I try to post a message to user wall, I see my app try to call facebook (It switch to facebook, and a loading message appear. After that should be a facebook login dialog comes out (it works in my iOS app) But, in Android - the facebook login won’t popup, it just go back to my app and do nothing.

I do three things in my app

  1. facebook.login( appId, listener, { “publish_stream”,“email”,“user_location”,“user_birthday” } )

  2. facebook.request( “me” )

  3. facebook.request( “me/feed”, “POST”, {
    message = fbpost[language][1] … high_score,
    link = fbpost[language][2],
    description = fbpost[language][3],
    picture = fbpost[language][4]
    } )

Could it be the UTF8 code problem? It works fine in iOS.

By the way, I found json.lua in the sample code can not handle Chinese character, so I do a workaround in that part. Maybe you can have a better json.lua for Chinese users some day.

BOB

[import]uid: 20999 topic_id: 9977 reply_id: 36722[/import]

Bob,

Did you set the Internet permissions parameter in build.settings file?

Did you try the Facebook sample app that ships with Corona?
We have a Nexus S in the office and I can try that on Monday.

-Tom [import]uid: 7559 topic_id: 9977 reply_id: 36728[/import]

Hi,

Did you set the Internet permissions parameter in build.settings file? (YES)

Did you try the Facebook sample app that ships with Corona? (I Will try it today!)

Bob [import]uid: 20999 topic_id: 9977 reply_id: 36734[/import]

Tom,

I tried the sample facebook program, and I found it couldn’t work on my Nexus S.
The result is just like my app.

BOB
[import]uid: 20999 topic_id: 9977 reply_id: 36752[/import]

Hey Folks,

Just adding to this thread that I just tried using Facebook connect in my Corona app with Android 2.3.3 on my new Samsung Galaxy S2, and it seems to give the same error.

When trying to connect to Facebook to show the login dialog, something goes wrong and it just shows an error in the dialog: “An error occurred. Please try again later”

Btw. this happens both wether the Facebook Android app is installed or not on the same device, since I tried uninstalling the Facebook app to see if it made a difference.

Everything works on iOS.

Cheers,

Trond.

[import]uid: 34372 topic_id: 9977 reply_id: 36840[/import]

I just tested the sample Facebook app on our Nexus S and it is working. I can logon and get the Facebook logon page. I can also post a message and photo to my Facebook page.

The only problem I’m seeing is the status box is not getting updated and it’s double posting the messages.

The same code (and test account) works fine on the iPad. I don’t have the official Facebook app installed.

Not sure why others are getting errors on logon. [import]uid: 7559 topic_id: 9977 reply_id: 36849[/import]

Ok. Do you have any other Android devices at Ansca to test with? [import]uid: 34372 topic_id: 9977 reply_id: 36850[/import]

I tested the Facebook sample code with three Android devices and they all work the same:
Nexus One
Nexus S
Droid

This is with build 505. [import]uid: 7559 topic_id: 9977 reply_id: 36854[/import]

I just tried building the Facebook sample code with Corona build 505 to make sure we’re on the same page, but that didn’t work either.

The builds should be identical, so I guess it must be the phone then, but to be certain, if you want, you could post a link to the build you used of the test app and I’ll test it on my phone?
[import]uid: 34372 topic_id: 9977 reply_id: 36865[/import]

We just fixed the problem with double postings on Android. The listener event.type was not correct. This should be available for testing in tomorrow’s daily build.

I don’t think this will fix the error during log-on (which we haven’t been able to reproduce).

Here is an updated “listener” that should replace the listener in the shipping Facebook sample app. This removed the debug code that displays all the listener events (this seemed to be causing problems).

[code]
– New Facebook Connection listener

local function listener( event )

— Debug Event parameters printout --------------------------------------------------
— Prints Events received up to 20 characters. Prints “…” and total count if longer

print( “Facebook Listener events:” )
–[[
local maxStr = 20 – set maximum string length
local endStr

for k,v in pairs( event ) do
if string.len(v) > maxStr then
endStr = " … #" … tostring(string.len(v)) … “)”
else
endStr = “)”
end
print( " " … tostring( k ) … “(” … tostring( string.sub(v, 1, maxStr ) ) … endStr )
end
–]]

— End of debug Event routine -------------------------------------------------------

print( "Events info: " … tostring(event.name), tostring(event.type) )

print( “event.name”, event.name ) – “fbconnect”
print( “event.type:”, event.type ) – type is either “session” or “request” or “dialog”
print( "isError: " … tostring( event.isError ) )
print( "didComplete: " … tostring( event.didComplete) )

– After a successful login event, send the FB command
– Note: If the app is already logged in, we will still get a “login” phase

if ( “session” == event.type ) then
– event.phase is one of: “login”, “loginFailed”, “loginCancelled”, “logout”
statusMessage.textObject.text = event.phase – tjn Added

print( "Session Status: " … event.phase )

if event.phase ~= “login” then
– Exit if login error
return
end

– The following displays a Facebook dialog box for posting to your Facebook Wall
if fbCommand == SHOW_DIALOG then
facebook.showDialog( {action=“stream.publish”} )
end

– Request the Platform information (FB information)
if fbCommand == GET_PLATFORM_INFO then
facebook.request( “platform” ) – **tjn Displays info about Facebook platform
end

– Request the current logged in user’s info
if fbCommand == GET_USER_INFO then
facebook.request( “me” )
– facebook.request( “me/friends” ) – Alternate request
end

– This code posts a photo image to your Facebook Wall

if fbCommand == POST_PHOTO then
local attachment = {
name = “Developing a Facebook Connect app using the Corona SDK!”,
link = “http://developer.anscamobile.com/forum”,
caption = “Link caption”,
description = “Corona SDK for developing iOS and Android apps with the same code base.”,
picture = “http://developer.anscamobile.com/demo/Corona90x90.png”,
actions = json.encode( { { name = “Learn More”, link = “http://anscamobile.com” } } )
}

facebook.request( “me/feed”, “POST”, attachment ) – posting the photo
end

– This code posts a message to your Facebook Wall
if fbCommand == POST_MSG then
local time = os.date("*t")
local postMsg = {
message = “Posting from Corona SDK! " …
os.date(”%A, %B %e") … ", " … time.hour … “:”
… time.min … “.” … time.sec
}

facebook.request( “me/feed”, “POST”, postMsg ) – posting the message
end

elseif ( “request” == event.type ) then
– event.response is a JSON object from the FB server
local response = event.response

if ( not event.isError ) then
response = json.decode( event.response )

if fbCommand == GET_USER_INFO then
statusMessage.textObject.text = response.name
printTable( response, “User Info”, 3 )
print( “name”, response.name )

elseif fbCommand == POST_PHOTO then
printTable( response, “photo”, 3 )
statusMessage.textObject.text = “Photo Posted”

elseif fbCommand == POST_MSG then
printTable( response, “message”, 3 )
statusMessage.textObject.text = “Message Posted”

else
– Unknown command response
print( “Unknown command response” )
statusMessage.textObject.text = “Unknown ?”
end

else
– Post Failed
statusMessage.textObject.text = “Post failed”
printTable( event.response, “Post Failed Response”, 3 )
end

elseif ( “dialog” == event.type ) then
– showDialog response

print( “dialog response:”, event.response )
statusMessage.textObject.text = event.response
end
end
[/code] [import]uid: 7559 topic_id: 9977 reply_id: 36879[/import]

Btw. while on the Facebook Connect topic:

In Corona’s current FB API, you provide a listener to the login() call which is used for every request() later, but when you then use request(), there is no reference passed on the to the listener so that you know what request you’re handling.

Just out of curiosity, why was such a design chosen?

Some issues with it comes to mind:

  • This forces the code to contain global variables like fbCommand in the example code to keep track of what request it being handled.

  • This forces serial handling of request()s instead of parallell handling. As a counter example is network.download() which can download many things in parallell.

  • You can’t use good lua code practices like closures

So I’m just wondering, was this design inevitable, because of how the FB Connect system work? (I haven’t used the FB iOS SDK myself, but AFAIK it uses a callback per request.)

Anyway, if that API is going to stay, is it OK to queu up a whole bunch of requests and then be sure that they all come back in the right order?

Cheers,

Trond.
[import]uid: 34372 topic_id: 9977 reply_id: 36881[/import]

Tom,

I rebuild the facebook sample app with your new listener( event ) with CORONA build 484

Looks like it did fix something. I can post a dialog to wall once! (via Show Dialog)

However, the other part like Get User and Post Msg and Post Photo still have problem.

Is your Nexus S OS version 2.3.4 ?

Bob [import]uid: 20999 topic_id: 9977 reply_id: 36893[/import]

Hi,

For your reference. I got a message on screen like “…tive access token must be …”

BOB [import]uid: 20999 topic_id: 9977 reply_id: 36894[/import]

Please try the FB sample with daily build 510, which should be available Tuesday morning (PDT) and see where we are. It does fix the response event for PostMsg and PostPhoto.

I agree that the FB sample is not implemented the best way. It calls the FB Logon for every request which I believe is the reason why you get a white blank screen for a fraction of a second. The proper way is to keep a flag showing that you’re logged in and just issue the request instead.

The FB API is calling the Facebook Graph API so I’m not sure if you can send multiple commands. You can read through the Facebook Graph API and the iOS code in GitHub to learn more. In my opinion the interface is not well documented when trying to implement and use their mobile interface.

From my understand of the interface you can only have one FB listener and it would need to handle FB callback for all API calls. Separating out the Login from the FB request calls would clean up the listener code by removing API calls embedded in the listener but you would still need a state machine to handle the “request” phase.

The purpose of the sample code is to demonstrate how to use the FB APIs. Feel free to improve the sample and share it with all the Corona users. I may do some work on the sample if I get some time.

Thanks,
Tom [import]uid: 7559 topic_id: 9977 reply_id: 36896[/import]

I am also having issues with facebook connect on android. The code lets me login and allow access but goes to a black screen and back to my game without posting the facebook message. Here is my code. I have the require facebook at the top and I removed my fbappid. I am using the Windows build 484 on a windows 7 machine.

– FACEBOOK BUTTON
local onFBTouch = function( event )
if event.phase == “release” and fbBtn.isActive then
audio.play( tapSound )

– Code to Post Status to Facebook (don’t forget the ‘require “facebook”’ line at top of module)
– The Code below is fully functional as long as you replace the fbAppID var with valid app ID.


local fbAppID = “” --> (string) Your FB App ID from facebook developer’s panel

local facebookListener = function( event )
if ( “session” == event.type ) then
– upon successful login, update their status
if ( “login” == event.phase ) then

local scoreToPost = comma_value(gameScore)

local statusUpdate = “just scored a " … gameScore … " on Sketch Smash!”

facebook.request( “me/feed”, “POST”, {
message=statusUpdate,
name=“Download Sketch Smash to Compete with Me!”,
caption=“Sketch Smash - Game for Iphone and Android.”,
link=“http://www.immortalinnovations.com”,
picture=“http://www.immortalinnovations.com/link-to-90x90-image.png” } )
end
end
end

facebook.login( fbAppID, facebookListener, { “publish_stream” } )

end
end [import]uid: 12716 topic_id: 9977 reply_id: 37021[/import]