admin管理员组文章数量:1426975
I included the socialsharing plugin into config.xml as:
<gap:plugin name="nl.x-services.plugins.socialsharing" />
(using cordova v. 3.3.1)
In my html I include:
<script src="phonegap.js"></script>
or
<script src="cordova.js"></script>
Now when calling:
function shareReport() {
window.plugins.socialsharing.share(mytext);
}
by a button:
onclick="shareReport()"
the program stops suddenly and closes down. ("mytext" is a global variable that is populated with a text string containing html tags - this variable has a value at this point)
Any suggestions what is going wrong ?
Thank you in advance, Chris
I included the socialsharing plugin into config.xml as:
<gap:plugin name="nl.x-services.plugins.socialsharing" />
(using cordova v. 3.3.1)
In my html I include:
<script src="phonegap.js"></script>
or
<script src="cordova.js"></script>
Now when calling:
function shareReport() {
window.plugins.socialsharing.share(mytext);
}
by a button:
onclick="shareReport()"
the program stops suddenly and closes down. ("mytext" is a global variable that is populated with a text string containing html tags - this variable has a value at this point)
Any suggestions what is going wrong ?
Thank you in advance, Chris
Share Improve this question asked Apr 9, 2014 at 4:40 ChrisChris 731 silver badge8 bronze badges 2- 1 does it give any clues in the console log? – flauntster Commented Apr 9, 2014 at 4:44
- what platform you currently use? – Nurdin Commented Apr 9, 2014 at 11:17
2 Answers
Reset to default 3Social sharing Plugin will work as you expected so it looks like you missed something, Check your XML for below fields,
<!-- for iOS -->
<feature name="SocialSharing">
<param name="ios-package" value="SocialSharing" />
</feature>
<!-- for Android -->
<feature name="SocialSharing">
<param name="android-package" value="nl.xservices.plugins.SocialSharing" />
</feature>
<!-- for Windows Phone -->
<feature name="SocialSharing">
<param name="wp-package" value="SocialSharing"/>
</feature>
AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Check your Script,
<script type="text/javascript" src="js/SocialSharing.js"></script>
This is must,
<gap:plugin name="nl.x-services.plugins.socialsharing" version="4.0" />
Try a test drive,
<button onclick="window.plugins.socialsharing.canShareVia('.apple.social.facebook', 'msg', null, null, null, function(e){alert(e)}, function(e){alert(e)})">is facebook available on iOS?</button>
Hope this helps.
OK, I figured it out. You were right, the SocialSharing plugin works simply by including the line
<gap:plugin name="nl.x-services.plugins.socialsharing" />
into config.xml. My problem came from unaccepted characters in the text that I sent for sharing which caused the program crash. Thanks for every help !
本文标签: javascriptPhonegapCordova socialsharing plugin not workingStack Overflow
版权声明:本文标题:javascript - PhonegapCordova: socialsharing plugin not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745475962a2659963.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论