Reputation: 7255
I am using Ionic 4 + SocialSharing-PhoneGap-Plugin.
I have the following code:
import { SocialSharing } from '@ionic-native/social-sharing/ngx';
constructor(private socialSharing: SocialSharing) { }
// Share message via WhatsApp
this.socialSharing.shareViaWhatsApp('Hi', null, null).then(() => {
// How to get the contact's details here, with whom
// I shared my message? Would like to get the name, number
// and all other contact info.
// Following Toast does not seem to trigger
this.toastService.presentToast('Successfully shared coupon on WhatsApp', 'success');
}).catch(() => {
// Sharing via WhatsApp is not possible. How to trigger a toast here as well?
});
Upvotes: 1
Views: 1315
Reputation: 1466
To access contacts, you'll need a separate plugin like Contacts -- maybe get the contact first using that plugin and then use shareViaWhatsAppToPhone
to share directly to that number.
The toast should work. From your example, it doesn't look like you've injected the ToastService
into the class.
Upvotes: 0