Facebook Interlock Cocos2d-X ver.

Facebook Interlocking with Cocos2d-X

2 min read
DevFacebookInterlockCocos2d-X

  • Facebook Interlock github link
  • Facebook Developer Site link
  • JNI Usage Guide link

Reference

Refer to Facebook's README

Overview

  1. Developer Registration
  2. Eclipse Environment Setup
  3. Troubleshooting
  4. Modifying AndroidManifest.xml
  5. Modifying String.xml
  6. Modifying AppActivity
  7. Utilizing JNI

1. Developer Registration

  1. App Creation
  2. Google Package Name
  3. Class Name
  4. Key Hash

2. Eclipse Environment Setup

  1. Import Facebook SDK downloaded into Eclipse
  2. Convert Facebook SDK to Library format
  3. Add Library to the project
  4. Put android.. and Bolt.. from Github Libs into the project's Libs folder.

3. Troubleshooting

  1. Add android.. and Bolt.. from Facebook SDK's properties -> Java Build Path -> Libraries to Add Jars.
  2. Change SDK version to 4.4.2W in Properties -> Android.
  3. Change JDK version to 1.7 from 1.6 in Java Compiler.
  4. If errors persist, change project's SDK version to above 4.

4. Modifying AndroidManifest.xml

<activity android:name="com.facebook.FacebookActivity"
          android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
          android:theme="@android:style/Theme.Translucent.NoTitleBar"
          android:label="@string/app_name" />
<meta-data android:name="com.facebook.sdk.ApplicationId"
           android:value="@string/facebook_app_id"/>

Add this.

5. Modifying String.xml

  • In rex/values/string.xml, add <string name="facebook_app_id">facebookId</string>.
  • Enter the key value received from the developer site into facebookId.

6. Modifying AppActivity

  • Login Functionality: Refer to site
  • Share Functionality: Refer to site

7. JNI Helper

If there is any incorrect content, please point it out.,
Please share any better methods or ideas you have.

banner
Reflections on Myself (2023 Review)