I have had social sharing in my app for a while now but when i tested it today It would only share an empty message.
When i click on the share button it shows the ‘shareWithOptions’ window and i can select an option. If i choose for example Facebook I get an empty ‘content/share field’ in Facebook where I can type in. So the url doesn’t get put in the message.
import {Component} from '@angular/core';
import {NavParams} from 'ionic-angular';
import {SocialSharing} from '@ionic-native/social-sharing';
import {Network} from '@ionic-native/network';
// Providers
import {DataService} from '../../providers/data.service';
// Moment.js
import * as moment from 'moment';
@Component({
selector: 'page-news-detail',
templateUrl: 'news-detail.html'
})
export class NewsDetail {
sharingOptions: object = {
url: 'http://www.google.nl'
};
constructor(public navParams: NavParams, private dataService: DataService, private socialSharing: SocialSharing, public network: Network) {
this.getData();
this.watchForReconnectAfterDisconnect();
}
/**
* Opens the share sheet.
*/
sharePost() {
this.socialSharing.shareWithOptions(this.sharingOptions);
}
}
html
<ion-header no-border>
<ion-navbar>
<ion-buttons end>
<button ion-button icon-only (click)="sharePost()" color="dark" clear>
<ion-icon class="share-icon" name="share-alt"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content class="has-header has-footer">
...
</ion-content>```