我们如何在MobileFirst中实现添加到任何(社交网络) [英] How we can implement add to any(Social networking) in MobileFirst
问题描述
我们如何实现添加到任何社交网络小部件,以便在Mobilefirst平台上分享facebook,twitter等中的照片。
我试过 http://www.addthis.com/
它正在开发公共资源预览但在Android和Windows 8模拟器和设备上失败。
How can we implement Add to any social network widget to share photos in facebook,twitter etc in Mobilefirst platform. I have tried the plugin from http://www.addthis.com/ It is working on Preview in Common Resources but failing in Android and windows 8 simulators and devices.
任何人都可以为MobileFirst Platform建议任何其他插件吗?
通过以下代码尝试了jquery共享,但没有工作。
Can anyone suggest any other plugin for MobileFirst Platform? Tried jquery share also by the following code but not working.
$('#mydiv').share({
networks: ['facebook','pinterest','googleplus','twitter','linkedin','tumblr','in1','email','stumbleupon','digg']
});
<div id="mydiv"></div>
推荐答案
更新:有关详细信息,请参阅此博客文章:< a href =https://developer.ibm.com/mobilefirstplatform/2015/08/03/integrating-3rd-party-cordova-plug-ins/ =nofollow noreferrer> https://developer.ibm。 com / mobilefirstplatform / 2015/08/03 / integrate-3rd-party-cordova-plug-ins /
Update: see this blog post for more information: https://developer.ibm.com/mobilefirstplatform/2015/08/03/integrating-3rd-party-cordova-plug-ins/
上述插件没有似乎适合移动应用程序IMO。
您可以谷歌搜索Cordova社交共享插件。
The mentioned "plug-in" does not seem fitting for mobile apps IMO.
You can google for Cordova social sharing plug-ins instead.
Android,iOS和Windows Phone的一个很有前途的插件是 PhoneGap社交分享插件。
One promising such plug-in for Android, iOS and Windows Phone is the PhoneGap Social Sharing plugin.
注意:您无法使用Cordova CLI安装步骤在Worklight / MobileFirst Platform中安装插件。相反,您需要按照提供的手动说明进行操作。
Note: You cannot use the Cordova CLI installation steps to install the plug-in in Worklight/MobileFirst Platform. Instead, you need to follow the manual instructions that are provided.
在执行此操作之前,请务必阅读用于处理Cordova插件的MFP教程,这样您就可以了解它是如何工作的MFP。
Before doing so it would be prudent to read the MFP tutorial for working with Cordova plug-ins so you will understand how it works in MFP.
我通过一些额外的调整让它在iOS上运行。
I got it to work on iOS with some extra tweaks.
注意:
- 第2步是必需的对于Android和Windows Phone 8以及它们各自的环境
- 在MobileFirst Studio中的每次构建之后都需要重复步骤2,因为这个文件在每次构建时都会被覆盖。 >
步骤:
- 有两个缺少的框架:
- MessageUI.framework
- Social.framework
更新(在Xcode中)www\worklight\cordova_plugins.js附加部分
Updating (in Xcode) www\worklight\cordova_plugins.js with an extra section
{
"file": "../js/SocialSharing.js",
"id": "nl.x-services.plugins.socialsharing",
"clobbers": [
"window.plugins.socialsharing"
]
}
注意: SocialSharing.js应放在common \ js中,并在index.ht的HEAD元素中引用ml
Note: SocialSharing.js should be placed in common\js as well as be referenced to in the HEAD element in index.html
编辑SocialSharing.js包装整个内容
Edit SocialSharing.js by wrapping the entire contents with
cordova.define("nl.x-services.plugins.socialsharing", function(require, exports, module) {
// file contents
);
在您的HTML中,从可用的选项中选择您想要的任何共享选项(请参阅插件文档)。
In your HTML, choose whichever sharing option you'd like from the available ones (see plug-in documentation for those).
最终结果:
这篇关于我们如何在MobileFirst中实现添加到任何(社交网络)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!