Updated 4 November 2017
There is some useful Intent to open from our Application in android.
1 2 3 4 5 6 7 8 9 |
void sendMail(String email){ Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( "mailto", email, null)); try { startActivity(Intent.createChooser(intent, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } } |
1 2 3 4 5 6 7 8 |
void call(String phoneNo){ Intent callIntent = new Intent(Intent.ACTION_DIAL); callIntent.setData(Uri.parse("tel:" + phoneNo)); // if (ActivityCompat.checkSelfPermission(ContactUs.this, android.Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { // return; // } ContactUs.this.startActivity(callIntent); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
private void openWhatsapp(String info) { PackageManager pm = getPackageManager(); try { PackageInfo pInfo = pm.getPackageInfo("com.whatsapp", PackageManager.GET_META_DATA); String smsNumber = info + "@s.whatsapp.net"; Uri uri = Uri.parse("smsto:" + smsNumber); Intent i = new Intent(Intent.ACTION_SENDTO, uri); i.setPackage("com.whatsapp"); startActivity(i); } catch (PackageManager.NameNotFoundException e){ showToast("Please install Whatsapp App"); } } |
where info is a WhatsApp mobile number.
1 2 3 4 5 |
void openBrowser(String url){ Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } |
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.