Reputation: 7947
I am in the process of trying to get facebook integration working with one of my apps. I have just read the documentation here in which it says:
"Firstly, to generate your key hash on your local computer, run Java's keytool utility (which should be on your console's path) against the Android debug keystore."
This is very confusing to me, does this mean that my app(+facebook integration) will only work on my "local computer" - i.e. an emulator running on my PC?.. and if so isn't there some way of getting a corresponding "key hash" for my android phone (connected to my PC via USB)? Because I'd much rather test my app on my phone than an emulator.
Upvotes: 0
Views: 635
Reputation: 5876
When you create an Android application that will be uploaded to the Google Play store, you generate a unique identifier that will allow Google, as well as every phone that installs your app, to know that you developed it. It is like your own secret password that you shouldn't share with anyone. If a malicious developer creates an "update" to your app, and somehow were to distribute it as such to users, any user that tried to install it would receive an error message because the malicious fake upgrade would not have been created with your private keystore. When you release your app, you'll have to make this keystore, as well as use it to generate a Facebook key hash, which is what they are referring to here.
However, when you are developing and not ready to release to the world, by default Eclipse will build your application using the default "debug" keystore. The instructions that you are referring to tell you how to generate the Facebook hash with your debug keystore. Once you do that, whenever you build your app with the debug keystore and run it, Facebook will allow it to connect using the SDK, as long as you have pasted that key hash into the Facebook developer console. It does not matter whether you are running the app on your computer or phone, it will run and connect with Facebook integration.
When you are ready to release, you'll have to generate a brand new keystore, run the tool again on that file, and upload that key hash to Facebook as before. Then, your app can run on anyone's phone and be able to connect to Facebook, provided you build it with the new keystore.
Upvotes: 1