Facebook --> Android Class name?

Hi there,

I want to set up a facebook app with Corona, and I’ve even managed to get my facebook hash-key but I have two questions:

  1. I can’t register my app without giving facebook the Android Class Name… But what the hell is that??
  2. Do I need to put my facebook hash key in any build settings? For iOS you need to do this, for Android I don’t know.

Thanks!
Thomas [import]uid: 70134 topic_id: 25672 reply_id: 325672[/import]

+1

What android class name should we use for linking? [import]uid: 22829 topic_id: 25672 reply_id: 103792[/import]

The “Android Class Name” is the full qualified name (ie: includes package/namespace name) of the activity class in your app that you want launched when someone taps a link to your app within the facebook app. That is, if someone taps a link to your app in facebook, it will automatically launch your app on the device.

The “Android Class Name” should be set to the following for all Corona made apps…
[lua]com.ansca.corona.CoronaActivity[/lua]

I haven’t had time to test this for myself yet. So, I don’t know if the above will launch your app from facebook. Meaning, I’m not sure if there are other requirements in order for facebook to launch your app… but you’re welcome to try it out for yourself. In fact, I and the rest of the Corona community would appreciate it if you would post the results here. [import]uid: 32256 topic_id: 25672 reply_id: 104062[/import]

It works, thanks! [import]uid: 22829 topic_id: 25672 reply_id: 104073[/import]

Hi Joshua,

I can confirm that setting Class name to “com.ansca.corona.CoronaActivity” gets facebook integration working.

Now I wonder what happens when there are 2 or more Corona apps installed on an Android device, and they all integrate with Facebook (“deep linking” in terms of Facebook documentation).

How will Facebook’s Android app differentiate between which app’s Main Activity to launch? I hope it will use the app’s package name to identify the correct app. Has this been tested? [import]uid: 135671 topic_id: 25672 reply_id: 108738[/import]

Good point… and hard to say. I have not tested this for myself. App activities are launched via intent objects on Android. Intents do allow package names to be set, but they are not required. So it all depends on how facebook coded it. Would you be willing to test it out? [import]uid: 32256 topic_id: 25672 reply_id: 108757[/import]

I will test this on Monday and let you know the results.

Kapil [import]uid: 135671 topic_id: 25672 reply_id: 108766[/import]

Perhaps it’s just me, but the documentation (and that blog post) isn’t totally clear about what settings to use for development and for distribution - for iOS as well as Android.

I’d like to see a ‘baby-steps’ style post that explains the whole process, with example provisioning / bundle id’s / android key hashes / package names etc etc [import]uid: 140429 topic_id: 25672 reply_id: 114426[/import]

I have not been able to get hash key for android but facebook seems to be working eitherway

Strange…

+1 for deitailled tutorial on getting hash key and so [import]uid: 76413 topic_id: 25672 reply_id: 117388[/import]

Please see last weeks FAQ dedicated to Facebook. It’s a big help…
http://www.coronalabs.com/blog/2012/07/25/faq-wednesday-your-facebook-questions/

The hash key only comes into play if the official Facebook app is installed on your Android device. If you do not have the Facebook app installed, then the hash key is not used and a web popup login will be displayed instead.

So, my recommendation is install the Facebook app and attempt to log in. If the log in fails, look at the Android device’s log via “adb logcat” or “ddms” and you should see a Facebook error message stating that your hash key is wrong and that same log message will give your the correct hash key for your app. Copy and paste that hash key to the Facebook develop web page and then you’re good to go! [import]uid: 32256 topic_id: 25672 reply_id: 117582[/import]

About the Android Class Name, “com.ansca.corona.CoronaActivity”, is it literally this? Or is this just a example format?

Do I need to do: com.mycompany.mygame.MygameActivity

or do I literally enter the following: com.ansca.corona.CoronaActivity

Naomi [import]uid: 67217 topic_id: 25672 reply_id: 118062[/import]

Naomi,

I’d imagine it is literally “com.ansca.corona.CoronaActivity”, because that’s the activity name generated by the corona build process. Unless this has changed since the last time I checked. That is why my earlier question about multiple Corona apps on same device. How will Facebook app know which app’s activity to launch.

It’s a shame that I never got around to test this out.

Regards,
Kapil [import]uid: 135671 topic_id: 25672 reply_id: 118064[/import]

@Naomi: u enter com.ansca.corona.CoronaActivity, at least that worked for me! [import]uid: 90610 topic_id: 25672 reply_id: 118069[/import]

Hey, @kapil.pendse and @dingo, thank you both so much. It’s weirding me out, but hey, if it does the job, it does, eh. I’m off to submitting it to FB now.

Thanks again!

Naomi [import]uid: 67217 topic_id: 25672 reply_id: 118070[/import]

Naomi,

Yes, the Android class name must be set to “com.ansca.corona.CoronaActivity” for you and everyone else. That name never changes. Not even when you change your app’s package name. This is because that is the name of the Java class and its namespace in our code.

This class name is needed by the Facebook app to display your app’s main “activity” (aka: window) via Android intents. I’m pretty sure it is not needed by single sign-on. I believe it is intended for displaying your app when someone taps a link posted by your app to a Facebook page. Although, I haven’t verified this for myself. [import]uid: 32256 topic_id: 25672 reply_id: 118076[/import]

Hey, Joshua, thank you for the detailed info. I appreciate it!

Naomi [import]uid: 67217 topic_id: 25672 reply_id: 118085[/import]

Did u use native android app to user hash key or u use corona sdk app?? [import]uid: 160777 topic_id: 25672 reply_id: 118095[/import]

@dev_wp7, I selected both Native iOS App and Native Android App. Under the Native Android App, I have Android Key Hash, Android Package Name and Android Class Name entered.

You may want to take a look at Joshua’s post #9 above, and as he suggests, you may want to take a look at:

http://www.coronalabs.com/blog/2012/07/25/faq-wednesday-your-facebook-questions/

Naomi [import]uid: 67217 topic_id: 25672 reply_id: 118096[/import]

But , i don’ t want to make my application neither Native iOS nor Native Android . I want to make it with just corona sdk . I think i misunderstanding something. I choose this two option to build my application on android and i phone even though my code with corona ,In other words i should choose this two option to make my app able to work on android and i phone ??? [import]uid: 160777 topic_id: 25672 reply_id: 118104[/import]

dev_wp7,

It’s just a way to tell Facebook whether you want to use Facebook in your Android app or in your iOS app or both platforms. Don’t worry, Corona SDK takes care of building your LUA+Corona code to the native platforms of Android and iOS. That is what the Corona build process is about.

What Facebook wants to know is some additional information for each platform. For iOS platform, Facebook wants to know your app’s bundle ID and iPhone/iPad App Store ID. This way, when a user taps/clicks on any content posted from your app to someone Facebook wall, they will be redirected to iPhone/iPad app store directly, to download your app.

For Android, Facebook wants to know your app’s Hash key, Package name and Class name. Again, the purpose is same: authentication of your app and redirection to Play store for direct download.

Regards,
Kapil [import]uid: 135671 topic_id: 25672 reply_id: 118109[/import]