Using Social Sharing plugin of ngCordova. Installed it manually using config.xml following : https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/README.md Whenever I try to use the following function,it is always entering into function(err)
View code :
<ion-pane>
<ion-header-bar class="bar-calm">
<h1 class="title">SMS</h1>
</ion-header-bar>
<ion-content class="has-header">
<ion-list>
<label class="item item-input item-input-stacked item-stable">
<span class="input-label"></span>
<input type="number" placeholder="Your number" ng-model="sms.num">
</label>
<label class="item item-input item-input-stacked item-stable">
<span class="input-label"></span>
<input type="text" placeholder="Your message" ng-model="sms.msg">
</label>
<button class="button button-block button-dark" ng-click="send()"> Send </button>
<button class="button button-block button-dark" ng-click="social()"> Social </button>
</ion-list>
</ion-content>
</ion-pane>
Angular Code:
.controller('ctrl', function($scope,$cordovaSms,$cordovaSplashscreen,$cordovaSocialSharing){
$scope.social = function(){
$cordovaSocialSharing.share("This is your message", "This is your subject", "www/img/ionic.png", "https://www.google.com")
.then(
function(result) {
console.log("Success");
console.log(result);
},
function(err) {
// An error occurred. Show a message to the user
console.log("error : "+err);
}
);
}
});
The error is resolved. It was an Android build error. I had to add a dependency in build.gradle file.
dependencies {
//
// IDE setting pulls in the specific version of v4 support you have installed:
//
//compile 'com.android.support:support-v4:21.0.3'
//
// generic directive pulls in any available version of v4 support:
//
compile 'com.android.support:support-v4:+'
}
Then installed it again via CLI and it worked fine. Thank You.