![](/img/trans.png)
[英]getting message **sharing failed please try again** in ionic app when I try to share link via whatsapp
[英]Ionic 4 + WhatsApp share - Get receiver / contact details after I share my message
我正在使用Ionic 4 + SocialSharing-PhoneGap-Plugin 。
我有以下代码:
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?
});
要访问联系人,您将需要一个单独的插件,例如Contacts -也许首先使用该插件获取联系人,然后使用shareViaWhatsAppToPhone
直接共享至该号码。
烤面包应该起作用。 从您的示例来看,您似乎没有将ToastService
注入到类中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.