Share a photo with the instagram app
Repo: https://github.com/vstirbu/InstagramPlugin
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-instagram-plugin $ npm install --save @ionic-native/instagram@4
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
Usage
import { Instagram } from '@ionic-native/instagram';
constructor(private instagram: Instagram) { }
...
this.instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
.then(() => console.log('Shared!'))
.catch((error: any) => console.error(error));
Instance Members
isInstalled()
Detect if the Instagram application is installed on the device.
Returns: Promise<boolean|string>
Returns a promise that returns a boolean value if installed, or the app version on android
share(canvasIdOrDataUrl, caption)
Share an image on Instagram Note: Instagram app stopped accepting pre-filled captions on both iOS and Android. As a work-around, the caption is copied to the clipboard. You have to inform your users to paste the caption.
Param | Type | Details |
---|---|---|
canvasIdOrDataUrl |
The canvas element id or the dataURL of the image to share |
|
caption |
The caption of the image |
Returns: Promise<any>
Returns a promise that resolves if the image was shared
shareAsset(assetLocalIdentifier)
Share a library asset or video
Param | Type | Details |
---|---|---|
assetLocalIdentifier |
A local fileURI |
Returns: Promise<any>
Returns a promise that resolves if the image was shared