GithubHelp home page GithubHelp logo

etiennea / phonegap-social-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emilycestmoi/phonegap-ios-social-plugin

0.0 1.0 0.0 454 KB

License: MIT License

Java 16.73% JavaScript 54.04% Objective-C 29.23%

phonegap-social-plugin's Introduction

Cordova / PhoneGap Sharing Plugin

added some android and updated for cordova 3.0 by Etienne Adriaenssen



DESCRIPTION

This plugin integrates with the iOS6+ social framework to provide social sharing. Features are only available on devices with iOS6+. It relies on iOS's social native sharing framework. The plugin can be seen as a lightweight alternative to the very heavy ShareKit.

REQUIREMENTS

  • iOS6+
  • Social.framework
  • PhoneGap / Cordova 3

AUTOMATIC INSTALLATION VIA CORDOVA CLI

  1. cordova platform add ios
  2. cordova plugin add https://github.com/bfcam/phonegap-ios-social-plugin
  3. cordova build

MANUAL INSTALLATION

  • In Xcode, drag the *.m and *.h files into your project under the Cordova "Plugins" directory.

  • Ensure that Xcode is set to copy the files if required.

  • Open the "Resources/Cordova.plist" file and under "Plugins" add a key with the plugin name "Social" and a string value of "Social".

  • Add Social.framework to your Xcode project as "Optional". To do this (Tested in Xcode 4.6), click on your project in the project navigator then select you app build target in the main window. Select the "Build Phases" tab. Expand "Link Binary With Libraries". Click the "+" and add "Social.framework" (under the iOS 6.x+ section). Mark the framework as being "Optional" (It will default to "Required"). Drag the "Social.framework" resource to sit under "Frameworks" in your project navigator.

  • Copy social.js to your www directory and include it in your index.html.

TUTORIAL

  • Check first if "iOSNativeSharing" can be used, it required iOS6+.
window.plugins.iOSNativeSharing.available(function(avail) {
  if (avail) {
    // Show sharing endpoints
  } else {
    // Sharing not not supported
  }
});
  • Once you have checked that Social is available you can allow for sharing.
  • To do this setup a button within your Cordova app that when triggered does something like this:
window.plugins.iOSNativeSharing.share('$MESSAGE', '$URL', '$IMAGE');

$MESSAGE and $URL are arbitrary strings. URLs are tested for validity, if they do not contain any protocol, "http://" will be prepended. The image is a file on the device itself. Sharing Image URLs ist untested, but should work.

The share services that are available are dictated by what has been setup in the iOS device settings by the user. Here is what the share screen looks like:

ScreenShot

CREDITS

Contributors :

phonegap-social-plugin's People

Contributors

sidneys avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.