Reputation: 73
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
Upvotes: 1
Views: 6527
Reputation: 73
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 !
Upvotes: 1
Reputation: 1274
Social 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('com.apple.social.facebook', 'msg', null, null, null, function(e){alert(e)}, function(e){alert(e)})">is facebook available on iOS?</button>
Hope this helps.
Upvotes: 3