ngCordova のソーシャル共有プラグインを使用します。次の config.xml を使用して手動でインストールしました: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/README.md 次の関数を使用しようとすると、常に関数(err)に入ります
コードを表示:
<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>
角度コード:
.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);
}
);
}
});