@ionic-native/social-sharing

  • Version 5.36.0
  • Published
  • 53.3 kB
  • 1 dependency
  • MIT license

Install

npm i @ionic-native/social-sharing
yarn add @ionic-native/social-sharing
pnpm add @ionic-native/social-sharing

Overview

Ionic Native - Native plugins for ionic apps

Index

Variables

variable SocialSharing

const SocialSharing: SocialSharingOriginal;

    Classes

    class SocialSharingOriginal

    class SocialSharingOriginal extends IonicNativePlugin {}
    • Social Sharing social-sharing Share text, files, images, and links via social networks, sms, and email.

      For Browser usage check out the Web Share API docs: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#5-web-share-api

      import { SocialSharing } from '@ionic-native/social-sharing/ngx';
      constructor(private socialSharing: SocialSharing) { }
      ...
      // Check if sharing via email is supported
      this.socialSharing.canShareViaEmail().then(() => {
      // Sharing via email is possible
      }).catch(() => {
      // Sharing via email is not possible
      });
      // Share via email
      this.socialSharing.shareViaEmail('Body', 'Subject', ['recipient@example.org']).then(() => {
      // Success!
      }).catch(() => {
      // Error!
      });

    method canShareVia

    canShareVia: (
    appName: string,
    message?: string,
    subject?: string,
    image?: string,
    url?: string
    ) => Promise<any>;
    • Checks if you can share via a specific app.

      Parameter appName

      App name or package name. Examples: instagram or com.apple.social.facebook

      Parameter message

      Parameter subject

      Parameter image

      Parameter url

      Returns

      {Promise}

    method canShareViaEmail

    canShareViaEmail: () => Promise<any>;
    • Checks if you can share via email

      Returns

      {Promise}

    method saveToPhotoAlbum

    saveToPhotoAlbum: (fileOrFileArray: string | string[]) => Promise<any>;
    • Save an array of images to the camera roll

      Parameter fileOrFileArray

      Single or multiple files

      Returns

      {Promise }

    method setIPadPopupCoordinates

    setIPadPopupCoordinates: (targetBounds: string) => void;
    • defines the popup position before call the share method.

      Parameter targetBounds

      left, top, width, height

    method share

    share: (
    message?: string,
    subject?: string,
    file?: string | string[],
    url?: string
    ) => Promise<any>;
    • Shares using the share sheet

      Parameter message

      The message you would like to share.

      Parameter subject

      The subject

      Parameter file

      URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone.

      Parameter url

      A URL to share

      Returns

      {Promise}

    method shareVia

    shareVia: (
    appName: string,
    message: string,
    subject?: string,
    image?: string,
    url?: string
    ) => Promise<any>;
    • Share via AppName

      Parameter appName

      App name or package name. Examples: instagram or com.apple.social.facebook

      Parameter message

      Parameter subject

      Parameter image

      Parameter url

      Returns

      {Promise}

    method shareViaEmail

    shareViaEmail: (
    message: string,
    subject: string,
    to: string[],
    cc?: string[],
    bcc?: string[],
    files?: string | string[]
    ) => Promise<any>;
    • Share via Email

      Parameter message

      Parameter subject

      Parameter to

      Parameter cc

      Optional

      Parameter bcc

      Optional

      Parameter files

      Optional URL or local path to file(s) to attach

      Returns

      {Promise}

    method shareViaFacebook

    shareViaFacebook: (
    message: string,
    image?: string,
    url?: string
    ) => Promise<any>;
    • Shares directly to Facebook

      Parameter message

      Parameter image

      Parameter url

      Returns

      {Promise}

    method shareViaFacebookWithPasteMessageHint

    shareViaFacebookWithPasteMessageHint: (
    message: string,
    image?: string,
    url?: string,
    pasteMessageHint?: string
    ) => Promise<any>;
    • Shares directly to Facebook with a paste message hint

      Parameter message

      Parameter image

      Parameter url

      Parameter pasteMessageHint

      Returns

      {Promise}

    method shareViaInstagram

    shareViaInstagram: (message: string, image: string) => Promise<any>;
    • Shares directly to Instagram

      Parameter message

      Parameter image

      Returns

      {Promise}

    method shareViaSMS

    shareViaSMS: (messge: string, phoneNumber: string) => Promise<any>;
    • Share via SMS

      Parameter messge

      message to send

      Parameter phoneNumber

      Number or multiple numbers seperated by commas

      Returns

      {Promise}

    method shareViaTwitter

    shareViaTwitter: (message: string, image?: string, url?: string) => Promise<any>;
    • Shares directly to Twitter

      Parameter message

      Parameter image

      Parameter url

      Returns

      {Promise}

    method shareViaWhatsApp

    shareViaWhatsApp: (
    message: string,
    image?: string,
    url?: string
    ) => Promise<any>;
    • Shares directly to WhatsApp

      Parameter message

      Parameter image

      Parameter url

      Returns

      {Promise}

    method shareViaWhatsAppToPhone

    shareViaWhatsAppToPhone: (
    phone: string,
    message: string,
    fileOrFileArray: string | string[],
    url?: string
    ) => Promise<any>;
    • Shares directly to a WhatsApp Contact with phone number.

      Parameter phone

      Pass phone number

      Parameter message

      Message to send

      Parameter fileOrFileArray

      fileOrFileArray Single or multiple files

      Parameter url

      Link to send

      Returns

      {Promise}

    method shareViaWhatsAppToReceiver

    shareViaWhatsAppToReceiver: (
    receiver: string,
    message: string,
    image?: string,
    url?: string
    ) => Promise<any>;
    • Shares directly to a WhatsApp Contact

      Parameter receiver

      Pass phone number on Android, and Addressbook ID (abid) on iOS

      Parameter message

      Message to send

      Parameter image

      Image to send (does not work on iOS

      Parameter url

      Link to send

      Returns

      {Promise}

    method shareWithOptions

    shareWithOptions: (options: {
    message?: string;
    subject?: string;
    files?: string | string[];
    url?: string;
    chooserTitle?: string;
    }) => Promise<any>;
    • Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)

      Parameter options

      The options object with the message, subject, files, url and chooserTitle properties.

      Returns

      {Promise}

    Package Files (1)

    Dependencies (1)

    Dev Dependencies (0)

    No dev dependencies.

    Peer Dependencies (2)

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ionic-native/social-sharing.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@ionic-native/social-sharing)
    • HTML
      <a href="https://www.jsdocs.io/package/@ionic-native/social-sharing"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>