【问题标题】:adding social share links to phonegap app将社交分享链接添加到 phonegap 应用程序
【发布时间】:2024-04-30 03:30:01
【问题描述】:

我有一个使用 jquery mobile 的应用程序,它输出和图像。

现在我已经在预览页面中显示了图像,并且我在下面添加了链接,以便在 facebook、twitter 和其他平台上分享它们

我该如何编写代码...

当用户点击分享按钮时,默认的分享面板应该像这样弹出

https://cdn.tutsplus.com/mobile/uploads/legacy/Android-SDK_Share-Activity/android_share_chooser.png

当用户选择例如 twitter 时,twitter 应用程序会打开并且应该附加图像。

如何实现这一点..我应该查看社交网站的 api 或 android api 或 phonegap api

【问题讨论】:

    标签: android jquery cordova phonegap-plugins facebook-social-plugins


    【解决方案1】:

    适用于 Android、iOS 和 Window 的 PhoneGap 社交分享插件

    使用 CLI 安装

    cordova 插件添加https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

    添加到你的页面

    <button onclick="window.plugins.socialsharing.share('Message, image and link', null, 'https://www.google.nl/images/srpr/logo4w.png', 'http://www.x-services.nl')">message, image and link</button>
    <button onclick="window.plugins.socialsharing.share('Message, subject, image and link', 'The subject', 'https://www.google.nl/images/srpr/logo4w.png', 'http://www.x-services.nl')">message, subject, image and link</button>
    

    More...

    【讨论】: