Android Launch Whatsapp
Launch Whatsapp:
If you are developing an Android application and wishes to integrate the application to the WhatsApp application by making a call with a WhatsApp number or contact, you may use an explicit Intent that will call the WhatsApp application with the number/contact.
Example:
// AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
// activity_launch_whatsapp.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".LaunchWhatsapp"
android:background="@color/colorAccent"
android:gravity="center"
android:padding="16dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Click on button to Launch Whatsapp"
android:textColor="@color/colorWhite"
android:textSize="30sp"
android:gravity="center"/>
<Button
android:id="@+id/click"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Launch Whatsapp"
android:textColor="@color/colorWhite"
android:textSize="16dp"
android:layout_marginTop="20dp"
android:background="@color/colorPrimaryDark"
/>
</LinearLayout>
Output