Skip to content

Using PhoneGap for Android, wraps CookLine, a web sample app that allows you to publish back to your Facebook Timeline about what you're eating, using Open Graph.

Notifications You must be signed in to change notification settings

agilemobiledev/android-phonegap-cookline

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CookLine for Android (using PhoneGap)

Using PhoneGap for Android, wraps CookLine, a web sample app that allows you to publish back to your Facebook Timeline about what you're eating, using Open Graph.

This sample code is the completed sample Android code that was presented at AnDevCon III 2012.

Authors: Christine Abernathy (caabernathy)

Installing

This section will walk you through the following:

  • Getting Started
  • Native SDK Integration Demo
    • Creating your Facebook app
    • Installing the Android app
  • Apache Cordova/PhoneGap Integration Demo
    • Install the CookLine Web App
    • Installing the Android app

Getting Started

Your install package should have the following files:

  • NativeSDK Android Project

  • WebCordova Android Project

To get the sample code do the following:

  • Install Git.

  • Pull the samples package from GitHub:

    git clone git://github.com/fbsamples/android-integration-sdk-phonegap

Creating your Facebook app (Native SDK Demo)

First set up a Facebook app using the Developer app:

  • Create a new Facebook app
  • (Optional) Enter the App Namespace when creating your app. You can choose a simple string to identify your app, such as ''awesomeapp'', but it must be unique.
  • Configure the Native Android App settings.
    • Enable the Configured for Android SSO setting.
    • Enter you app's signature in the Android Key Hash field. For more information see the Android Tutorial.
    • Enter "com.facebook.samples.myapp" in the Android Package Name setting.
    • Enter "com.facebook.samples.myapp.App" in the Android Class Name setting.
    • Enter a value for the Android Market URI. The value must correspond to any valid Google Play URL.

Installing the Android app (Native SDK Demo)

  1. Get the latest Facebook Android SDK from GitHub: git clone git://github.com/facebook/facebook-android-sdk.git

  2. Launch Eclipse

  3. Create a Facebook Android SDK Project:

    1. From the Eclipse menu, navigate to File > New > Android Project
    2. Select "Create project from existing source"
    3. The Facebook Android SDK package should include a folder, facebook-android-sdk/facebook
    4. Browse to the facebook folder and select it
    5. Click Next
    6. Select Android 2.2 as the Build Target
    7. Click Finish
  4. Import the sample app:

    1. From the Eclipse menu, navigate to File > Import
    2. Select General > Existing Projects into Workspace
    3. The sample package should include a folder, NativeSDK
    4. Browse to the NativeSDK folder and select it
    5. Click Finish
  5. Include the Facebook Android SDK:

    1. From the Eclipse Package Explorer, select the NativeSDK project
    2. Right-click and select the Properties menu
    3. In the Library section, click Add
    4. Select com_facebook_android
    5. Click OK
    6. Click OK to exit the Properties dialog
  6. Set up your App ID:

    1. From the Eclipse Package Explorer, select the NativeSDK project

    2. Open up App.java (under the src/com.facebook.samples.myapp folder)

    3. Change the existing app ID:

         public static final String APP_ID = "321416411224717";
      

    to:

          public static final String APP_ID = "YOUR_APP_ID";
    
  7. Install the Facebook app. Go to the Android Tutorial to find more instructions on this.

  8. Run the application as an Android Application. If you have any issues check out the Android Tutorial.

Install the CookLine Web App

Follow the CookLine app install instructions. Note your app's domain, namespace, and app Id. You will use this to configure your app in the next section.

Installing the Android app (Apache Cordova Demo)

  1. Get the latest Facebook Android SDK from GitHub, if not previously cloned: git clone git://github.com/facebook/facebook-android-sdk.git

  2. Download the latest Apache Cordova (PhoneGap) build from www.phonegap.com/download

  3. Get the latest Apache Cordova Facebook Connect Plugin from GitHub: git clone https://github.com/davejohnson/phonegap-plugin-facebook-connect.git

  4. Get the latest Facebook Android SDK from GitHub: git clone git://github.com/facebook/facebook-android-sdk.git

  5. Launch Eclipse

  6. Create a Facebook Android SDK Project if you have done so previously.

  7. Import the sample app:

    1. From the Eclipse menu, navigate to File > Import
    2. Select General > Existing Projects into Workspace
    3. The sample package should include a folder, WebCordova
    4. Browse to the WebCordova folder and select it
    5. Click Finish
  8. Include the Facebook Android SDK:

    1. From the Eclipse Package Explorer, select the WebCordova project
    2. Right-click and select the Properties menu
    3. In the Library section, click Add
    4. Select com_facebook_android
    5. Click OK
    6. Click OK to exit the Properties dialog
  9. Edit the CookLine web files - beef_curry.html, lasagne.html, pizza.html:

    1. Change occurrences of ''294113397324835'' to ''YOUR_APP_ID''
    2. Change occurrences of ''cookline.herokuapp.com'' to your domain
    3. Change occurrences of ''cookline:'' to ''YOUR_APP_NAMESPACE:''
  10. Install Cordova libraries, scripts:

    1. Copy <CORDOVA-INSTALL>/lib/android/cordova-1.7.0.jar to the WebCordova project libs folder
    2. Copy <CORDOVA-INSTALL>/lib/android/cordova-1.7.0.js to the WebCordova project assets/www folder
    3. Copy <CORDOVA-INSTALL>/lib/android/xml to the WebCordova project res folder
  11. Install Apache Cordova Facebook Connect Plugin libraries, scripts:

    1. Copy <PLUGIN-INSTALL>/www/cdv-plugin-fb-connect.js to the WebCordova project assets/www folder
    2. Copy <PLUGIN-INSTALL>/lib/facebook_js_sdk.js to the WebCordova project assets/www folder
    3. Copy <PLUGIN-INSTALL>/native/android/src/org to the WebCordova project src folder
  12. Run the application as an Android Application. If you have any issues check out the Android Tutorial.

Contributing

All contributors must agree to and sign the Facebook CLA prior to submitting Pull Requests. We cannot accept Pull Requests until this document is signed and submitted.

License

Copyright 2012-present Facebook, Inc.

You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, and distribute this software in source code or binary form for use in connection with the web services and APIs provided by Facebook.

As with any software that integrates with the Facebook platform, your use of this software is subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. This copyright notice shall be included in all copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Using PhoneGap for Android, wraps CookLine, a web sample app that allows you to publish back to your Facebook Timeline about what you're eating, using Open Graph.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published