i use ionic 3 and SocialSharing plugin it works well when using :
socialSharing.shareViaWhatsApp
whats(){
//this.socialSharing.shareViaWhatsApp("I needed a "+this.message,null,null)
this.socialSharing.shareViaWhatsApp("اI NEED "+this.message, null, null)
.then(() => console.log('ok'))
.catch(() => console.log('not ok'));
}
but app crash and close in use :
shareViaWhatsAppToReceiver
whats(){
//this.socialSharing.shareViaSMS("I needed a "+this.message,"+249922222343")
this.socialSharing.shareViaWhatsAppToReceiver("00249922222343", "I needed a "+this.message, null, null)
.then(() => console.log('ok'))
.catch(() => console.log('not ok'));
}
ionic info :
$ ionic info
cli packages: (C:\\Users\\abdo\\AppData\\Roaming\\npm\\node_modules) @ionic/cli-utils : 1.19.1 ionic (Ionic CLI) : 3.19.1 global packages: cordova (Cordova CLI) : 7.1.0 local packages: @ionic/app-scripts : 3.1.8 Cordova Platforms : android 6.3.0 Ionic Framework : ionic-angular 3.9.2 System: Node : v8.9.3 npm : 5.5.1 OS : Windows 7
Please help me
the country key must be there. 00 will not work, it must be + sign followed by the country key then the number ie +310433885282. 00310433885282 won't work. Note that on Android you can only send a 'text' and 'url' directly to someone, so files are ignored.
By phone number (since 5.3.0)
<button onclick="window.plugins.socialsharing.shareViaWhatsAppToPhone('+31611111111', 'Message via WhatsApp', null /* img */, null /* url */, function() {console.log('share ok')})">msg via WhatsApp to phone number +31611111111</button>
By abid (iOS) or phone number (Android)
<button onclick="window.plugins.socialsharing.shareViaWhatsAppToReceiver('101', 'Message via WhatsApp', null /* img */, null /* url */, function() {console.log('share ok')})">msg via WhatsApp for Addressbook ID 101</button>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.