[英]Ionic 4 + WhatsApp share - Get receiver / contact details after I share my message
I am using Ionic 4 + SocialSharing-PhoneGap-Plugin . 我正在使用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?
});
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. 要访问联系人,您将需要一个单独的插件,例如Contacts -也许首先使用该插件获取联系人,然后使用shareViaWhatsAppToPhone
直接共享至该号码。
The toast should work. 烤面包应该起作用。 From your example, it doesn't look like you've injected the ToastService
into the class. 从您的示例来看,您似乎没有将ToastService
注入到类中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.