Creating Facebook app for Android - quesiton

>> If I use “com.ansca.corona.CoronaActivity” will that cause problems with multiple apps?

No, because the “package name” you provide uniquely identifies your app.

The Android intent used to launch your app requires both a package name and the class type of the component to launch in its constructor, as documented here…
http://developer.android.com/reference/android/content/Intent.html#Intent(android.content.Context,%20java.lang.Class>)

And by the way, as of this week’s daily builds, Corona now supports launch arguments and the “applicationOpen” system events on Android. These features allow your app to support facebook deep linking. [import]uid: 32256 topic_id: 32551 reply_id: 129570[/import]

What is “facebook deep linking”? [import]uid: 19626 topic_id: 32551 reply_id: 129577[/import]

Here is facebook’s official documentation on deep linking…
http://developers.facebook.com/docs/mobile/android/deep_linking/

So, when the user taps on your app’s link in facebook, it will launch your app and pass the URL that the user tapped on as an argument. You can customize the URL with parameters to tell your app to display a particular screen or perform a particular operation. [import]uid: 32256 topic_id: 32551 reply_id: 129594[/import]

@Joshua,

I don’t know what else to do, I still get the “App Name is misconfigured for Facebook login”. In the facebook Developers do I need to actually publish my app so that its live on facebook?

There is a “Submit App Details” button, which I have not done yet because my app is not 100% finished [import]uid: 19620 topic_id: 32551 reply_id: 129596[/import]

I think you are setting up the wrong section on the facebook developer page.

You should be setting up your Android app in the “Settings\Basic” page. That’s where you set up your mobile app and obtain an app ID. There is only a “Save Changes” button at the bottom of that page. I believe that should be enough. [import]uid: 32256 topic_id: 32551 reply_id: 129597[/import]

Does anyone know if your app needs to be active and published in the google play market to be able to test facebook integration? Maybe that is why I am getting this error? [import]uid: 19620 topic_id: 32551 reply_id: 129722[/import]

No it does not. The app I’m building now is perfectly fine on Android with Facebook.

[import]uid: 19626 topic_id: 32551 reply_id: 129728[/import]

I have a feeling my problem has to do with how I am trying to log into facebook. A lot of the guides talk about entering in a bad hash, running the app and looking at the log to see the correct hash. I believe I have the correct hash, and I have it entered on facebook. Does this same hash need to be put somewhere inside my actual app as well?

I am using the GGFacebook module found here: http://developer.coronalabs.com/code/ggfacebook

I am trying ot login to facebook just by doing
[lua]local appID = “***************” (real app ID there)
facebook = GGFacebook:new( appID )
facebook:login()[/lua]

Does my hash need to be included in my GGFacebook:new call?

Here is what the documentation says from the above link:
“Create your Facebook object passing in your apps id, optional listener and permissions
local facebook = GGFacebook:new( appID, listener, permissions )” [import]uid: 19620 topic_id: 32551 reply_id: 129742[/import]

Does anyone know if your app needs to be active and published in the google play market to be able to test facebook integration? Maybe that is why I am getting this error? [import]uid: 19620 topic_id: 32551 reply_id: 129722[/import]

No it does not. The app I’m building now is perfectly fine on Android with Facebook.

[import]uid: 19626 topic_id: 32551 reply_id: 129728[/import]

I have a feeling my problem has to do with how I am trying to log into facebook. A lot of the guides talk about entering in a bad hash, running the app and looking at the log to see the correct hash. I believe I have the correct hash, and I have it entered on facebook. Does this same hash need to be put somewhere inside my actual app as well?

I am using the GGFacebook module found here: http://developer.coronalabs.com/code/ggfacebook

I am trying ot login to facebook just by doing
[lua]local appID = “***************” (real app ID there)
facebook = GGFacebook:new( appID )
facebook:login()[/lua]

Does my hash need to be included in my GGFacebook:new call?

Here is what the documentation says from the above link:
“Create your Facebook object passing in your apps id, optional listener and permissions
local facebook = GGFacebook:new( appID, listener, permissions )” [import]uid: 19620 topic_id: 32551 reply_id: 129742[/import]

For anyone else having the same issue that I posted above, I got my issue resolved. I thought for sure I had the correct android hash key because I followed facebook’s instructions on how to get it using the java SDK with a commandline call. Turns out it was false. I entered in “12345” in my facebook apps hash key. Then download the app “logcat”, run your app and you will get the normal error that I had, and just click “okay” on the error that comes up. Then open “logcat”, and you will find an error that has the facebook login error, and it will tell you the correct hash key there. Entered the one shown there and now my facebook login error is resolved, huzzah! hope this helps others. [import]uid: 19620 topic_id: 32551 reply_id: 129855[/import]

For anyone else having the same issue that I posted above, I got my issue resolved. I thought for sure I had the correct android hash key because I followed facebook’s instructions on how to get it using the java SDK with a commandline call. Turns out it was false. I entered in “12345” in my facebook apps hash key. Then download the app “logcat”, run your app and you will get the normal error that I had, and just click “okay” on the error that comes up. Then open “logcat”, and you will find an error that has the facebook login error, and it will tell you the correct hash key there. Entered the one shown there and now my facebook login error is resolved, huzzah! hope this helps others. [import]uid: 19620 topic_id: 32551 reply_id: 129855[/import]

I’m glad you got it working!

Yeah, setting up facebook with the wrong hash key is by far the most common issue and it comes up on our forums several times a week. It’s to the point where I think us documenting it just isn’t enough. We might have to get a little more aggressive about it and just display an alert dialog to inform the developer, “Hey! Listen! Your hash key is wrong! Use this hash key!”… but state it in a nicer way of course. :slight_smile: [import]uid: 32256 topic_id: 32551 reply_id: 129927[/import]

I’m glad you got it working!

Yeah, setting up facebook with the wrong hash key is by far the most common issue and it comes up on our forums several times a week. It’s to the point where I think us documenting it just isn’t enough. We might have to get a little more aggressive about it and just display an alert dialog to inform the developer, “Hey! Listen! Your hash key is wrong! Use this hash key!”… but state it in a nicer way of course. :slight_smile: [import]uid: 32256 topic_id: 32551 reply_id: 129927[/import]

Yea maybe create a blog post and then link to it on the documentation pages that talk about facebook connectivity. Would save people lots of time! [import]uid: 19620 topic_id: 32551 reply_id: 130022[/import]

Thanks for this information. It will be very helpful while working on my Facebook app.

Do you know how to save a picture from the camera to sent to my Facebook page? I made a post about this and have not gotten any replies. I even posted I would pay for an answer.

Thanks!
[import]uid: 184193 topic_id: 32551 reply_id: 130024[/import]

Well I know how to save a picture from the corona display screen, but not from the phones camera. For this scenario you can use “display.save”. Sorry not sure about using the phones camera [import]uid: 19620 topic_id: 32551 reply_id: 130033[/import]

The following code grabs a picture from the camera and is loaded into the image variable. Do you know how to save the image from here to file?

--   
-- Abstract: Camera sample app  
--   
-- Version: 1.2  
--   
-- Updated: September 21, 2011  
--  
-- Update History:  
-- v1.1 Fixed logic problem where it said "session was cancelled".  
-- v1.2 Added Android support.  
--  
-- Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license  
-- Copyright (C) 2011 Corona Labs Inc. All Rights Reserved.  
---------------------------------------------------------------------------------------  
-- Camera not supported on simulator.   
local isXcodeSimulator = "iPhone Simulator" == system.getInfo("model")  
if (isXcodeSimulator) then  
 local alert = native.showAlert( "Information", "Camera API not available on iOS Simulator.", { "OK"})   
end  
  
--  
local bkgd = display.newRect( 0, 0, display.contentWidth, display.contentHeight )  
bkgd:setFillColor( 128, 0, 0 )  
  
local text = display.newText( "Tap anywhere to launch Camera", 0, 0, nil, 16 )  
text:setTextColor( 255, 255, 255 )  
text.x = 0.5 \* display.contentWidth  
text.y = 0.5 \* display.contentHeight  
  
local sessionComplete = function(event)   
 local image = event.target  
  
 print( "Camera ", ( image and "returned an image" ) or "session was cancelled" )  
 print( "event name: " .. event.name )  
 print( "target: " .. tostring( image ) )  
  
 if image then  
 -- center image on screen  
 image.x = display.contentWidth/2  
 image.y = display.contentHeight/2  
 local w = image.width  
 local h = image.height  
 print( "w,h = ".. w .."," .. h )  
 native.showAlert("Corona", "See image???")  
 end  
end  
  
local listener = function( event )  
 if media.hasSource( media.Camera ) then  
 media.show( media.Camera, sessionComplete )  
 else  
 native.showAlert("Corona", "Camera not found.")  
 end  
 return true  
end  
bkgd:addEventListener( "tap", listener )  

[import]uid: 184193 topic_id: 32551 reply_id: 130038[/import]

Yea maybe create a blog post and then link to it on the documentation pages that talk about facebook connectivity. Would save people lots of time! [import]uid: 19620 topic_id: 32551 reply_id: 130022[/import]