How to add Facebook SDK for mobile apps

12 posts, 0 answers
  1. Христо
    Христо avatar
    13 posts
    Member since:
    Oct 2013

    Posted 07 Jan 2015 Link to this post

    Hello,
    I want to create some Facebook Mobile App Ads but I found a problem with the installation of the Facebook iOS and Android SDKs. The main problem comes from step 2: https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads?locale=bg_BG#add-sdk when I have to add Facebook APP ID to my hybrid application.
    Is it possible to set these APP_ID settings ?

    Thank you :)
  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 12 Jan 2015 Link to this post

    Hi,

    Thank you for posting to the Telerik Developer Forums.

    Within a hybrid app built with Telerik AppBuilder you can use the Facebook SDK only through an Apache Cordova plugin, for example, the Facebook Connect plugin.

    The AppBuilder-compatible version can be found here.

    The plugin is not intended particularly for usage with Facebook Ads, but you can access the SDK through it. For example, import the plugin in your AppBuilder project and through the Data Navigator - open the platforms/ios/HelloCordova/Plugins/com.phonegap.plugins/facebookconnect and locate the FacebookConnectPlugin.m implementation file. Navigate to line 58 and in the applicationDidBecomeActive method you will be able to call the method referenced in the Facebook documentation.

    In case you need to use specific methods and events from the SDK in your app, they need to be exposed from the JS API of the plugin (if they are not available in the plugin).

    Let me know if this helps and if you have questions.

    Regards,
    Anton Dobrev
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  3. Zygimantas
    Zygimantas avatar
    3 posts
    Member since:
    Nov 2014

    Posted 12 Jan 2015 in reply to Anton Dobrev Link to this post

    Do we need to reference facebookConnectPlugin.js file?
    If not, I am getting: "ReferenceError: facebookConnectPlugin is not defined" error.
    In other case, the "Error: init not called with valid version" error.
  4. Zygimantas
    Zygimantas avatar
    3 posts
    Member since:
    Nov 2014

    Posted 12 Jan 2015 in reply to Zygimantas Link to this post

    Update: that happens in Simulator. As I understand, we can't test custom plugins in simulator and they will break the simulator once installed. So, what is the way of developing the application with FB plugin?
  5. Zygimantas
    Zygimantas avatar
    3 posts
    Member since:
    Nov 2014

    Posted 12 Jan 2015 Link to this post

    In addition to this, we can even test the plugin in companion app. Am I missing something?
  6. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 15 Jan 2015 Link to this post

    Hi,

    @ Zygimantas

    Unfortunately the plugin is not available in the simulator. However, the error displayed in the simulator console should be handled which will be addressed in some of the next Telerik AppBuilder releases. Thus you will be able to test apps with custom plugins in the simulator (the functionality deriving from plugins will not work). 

    You need to test the app after deploying it on a connected device for best experience. Here you can read about the available debugging options on a device from within AppBuilder.

    Please, let me know if you have further questions.

    Best regards,
    Anton Dobrev
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  7. Greg Galipeau
    Greg Galipeau avatar
    13 posts
    Member since:
    Jul 2009

    Posted 03 Jul 2015 Link to this post

    I am confused on this post. Telerik has there own version of the Cordova Facebook plugin. However, it doesn't work in the Telerik simulator? That makes no sense and makes it almost impossible to develop against. If Facebook integration is the main purpose of an application, it has to work in the simulator to develop. You can't honestly expect developers to do a complete deploy every time they want to debug something. That is impossible. So, if it doesn't work in the simulator, it's basically like Telerik doesn't even have this available. Am I missing something? Someone please tell me there is a way to get the Facebook plugin that Telerik says they support to actually work with the Telerik product (i.e.: the simulator)!
  8. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 08 Jul 2015 Link to this post

    @ Greg

    Thanks for your input.

    You are right, the built-in AppBuilder simulator does not provide a support for custom Cordova plugins. The functionality included majority of the Cordova API plugins is mocked up in the simulator implementation.  Thus in the simulator you can open a library of images, open a file, rotate the device orientation, simulate geolocation and network information.

    Because the Facebook plugin is essentially a custom plugin that provides a functionality that relies on the native Facebook SDKs for the given platform, it is not available in the simulator. Basically this version of the plugin available in the Telerik Marketplace is modified to be easily used within an AppBuilder project, to be able to build it with the AppBuilder build services and ultimately, provide a native Facebook integration in your mobile app.

    Given that we always recommend testing on real devices your app as the most correct way to test your app during its development lifecycle, there is a LiveSync feature – you do not have to redeploy the app every time, unless you have made some project-critical changes that cannot be LiveSynced (refer to the link above for a list of them). Debugging on device and using the native emulators expand further the options available to your testing process.

    Let me know if you have further suggestions or considerations.

    Edit - I edited the styles (font color) of the post.

    Regards,
    Anton Dobrev
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     

  9. Greg Galipeau
    Greg Galipeau avatar
    13 posts
    Member since:
    Jul 2009

    Posted 08 Jul 2015 in reply to Anton Dobrev Link to this post

    Honestly, that is not acceptable from a developers point of view. Debugging on a device is not a sustainability development strategy for any true development project. Maybe it is ok for people building simple stuff. But, not for large, complex applications (which is why people choose third party frameworks like Telerik). I do like the LiveSync feature and I use it all the time. I use it to "test" my development efforts on a device. But, that is not how "development cycles" work. Developers develop on their computer, get it right and then LiveSync to a device to test. You have taken out the ability to develop and debug on a computer. Instead you make us go through a  process of LiveSyncing to a device. That is not suitable for large complex projects (especially in the case of this forum -  if an app has Facebook as it's core functionality). Anyways, as an experienced developer of apps on many different platforms, this is the biggest drawback of the Telerik platform. All I want to do is be able to use the verified tools in a "normal" development lifecycle. In cases like this, I have to skip part of the development lifecylce and LiveSync to do development. That is not acceptable and is a huge downside to your product. I implore you to rethink this strategy and make every plugin work in your simulators if you wish to call them "verified". It is deceiving to your developers if you don't do this.
  10. Rob Lauer
    Admin
    Rob Lauer avatar
    18 posts

    Posted 08 Jul 2015 Link to this post

    Hi Greg,

    I completely understand your frustrations. Our simulators do mock the core Cordova plugins today and we are considering mocking certain custom plugins going forward. As you can imagine though, mocking all of the possible native device features is a significant technical task.

    I can suggest that with the Facebook plugin, I have heard of many people utilizing (and sometimes favoring) the Facebook JavaScript SDK: https://developers.facebook.com/docs/javascript

    This will work fine in the simulators. We are also working on some features that will bridge that gap that exists between the simulators and testing on a device - stay tuned!

    Regards,
    Rob Lauer
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  11. Greg Galipeau
    Greg Galipeau avatar
    13 posts
    Member since:
    Jul 2009

    Posted 08 Jul 2015 in reply to Rob Lauer Link to this post

    That is understandable. I completely understand it takes time to put things into a product like this. I think that will be a great addition to your product.

    FYI - I am using the Facebook JavaScript SDK. It works great for retreiving and such. I am not a big fan of the login process. Works great 99% of the time. Every once in a while gets to a blank white page that says sign in. I think I might put an if statement in to see if I am in the simulator or not and use the Cordova plugin for login to get the key. Then use the JavaScript for retrieval of feed information. That should give me the professional login interaction I am looking for.

  12. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 13 Jul 2015 Link to this post

    Hello Greg,

    Thank you for input, indeed, you may consider to use the JS SDK when testing in the simulator and use the plugin in the production app package in order to provide the best user experience to your customers.

    Please, let us know if you have further questions or suggestions.

    Regards,
    Anton Dobrev
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top