Call Following Method
sendWhatsApp("Hi Dear , I am Dhaval Solanki")
///////////////////////////////
private void sendWhatsApp(String s) {
sendWhatsApp("Hi Dear , I am Dhaval Solanki")
///////////////////////////////
private void sendWhatsApp(String s) {
Intent whatsappIntent = new Intent(Intent.ACTION_SEND); whatsappIntent.setType("text/plain"); whatsappIntent.setPackage("com.whatsapp"); whatsappIntent.putExtra(Intent.EXTRA_TEXT, s); try { startActivity(whatsappIntent); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(getBaseContext(), "Whatsapp Not Installed", Toast.LENGTH_SHORT).show(); try { Uri uri = Uri.parse("market://details?id=com.whatsapp"); Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); startActivity(goToMarket); } catch (Exception en) { en.printStackTrace(); } } }
1 comment:
Thank you Dhavalbhai.
Post a Comment