Reputation: 3868
I've developed an ionic 3 app. I am unable to open whatsapp from my app with a specific contact in ionic 3. i don't want to send or share any thing but only wants to open whatsapp in android & iOS from my app with a specific contact. Is there any way to open whatsapp? Till now i have implemented as below which is not working
window.open(`whatsapp:${+911234567890}`, '_system');
Any help much appreciate.
Upvotes: 5
Views: 3381
Reputation: 185
I am Using this:
String phone = "+8801510101010";
PackageManager packageManager = MainActivity.this.getPackageManager();
Intent i = new Intent(Intent.ACTION_VIEW);
try {
String url = "https://api.whatsapp.com/send?phone="+ phone;
i.setPackage("com.whatsapp");
i.setData(Uri.parse(url));
if (i.resolveActivity(packageManager) != null) {
MainActivity.this.startActivity(i);
}
} catch (Exception e){
e.printStackTrace();
}
Upvotes: 0
Reputation: 46
See it: http://phonegap-plugins.com/plugins/ranjitpandit/whatsapp-phonegap-plugin
cordova.plugins.Whatsapp.send("yourNumber", sucessoCallback, errorCallback);
Upvotes: 3