how to send whatsapp message from your android app using intent
MainActivity.java
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// open whatsapp through intent
openWhatsApp("+919865426582");
}
private void openWhatsApp(String contactNumber) {
String url = "https://api.whatsapp.com/send?phone=" + contactNumber;
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
intent.setPackage("com.whatsapp");
startActivity(intent);
}
}
Projects with Source Code + Video Tutorials
You can download our Java and Android Studio Projects with Source Code and Video Tutorials.
![Firebase-Push-Notifications-|-Background-Notification](https://learnoset.com/Learnoset/Projects/FirebasePushNoti/firebase_push_notification.png)
Firebase Push Notifications | Background Notification
![Online-Tic-Tac-Toe-game-Using-Firebase-Database-in-Android-Studio](https://learnoset.com/Learnoset/Projects/OnlineTicTacToe/online-tic-tac-toe-game-in-android-studio.png)
Online Tic Tac Toe game Using Firebase Database in Android Studio
![Simple-Music-Player-App-for-Android-(Offline-Version)](https://learnoset.com/Learnoset/Projects/MusicPlayer/thumnail.jpg)
Simple Music Player App for Android (Offline Version)
If you have any Questions or Queries
You can mail us at info.learnoset@gmail.com
Follow us to learn Coding and get in touch with new Technologies.