Force a default browser on my android phone using a simple html shortcut page

You can let user choose it via Intent as so:

Intent email = new Intent(Intent.ACTION_SEND);
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_EMAIL,new String[]{ "[email protected]" });
email.putExtra(Intent.EXTRA_SUBJECT,"INSERT SUBJECT HERE");
email.putExtra(Intent.EXTRA_TEXT,"INSERT BODY HERE");
try{
    Intent.createChooser( email, null );
}catch(ActivityNotFoundException e){
    // WHATEVER
}  

Letting the default app handle the email:

Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data = Uri.parse("mailto:?subject=" + subject + "&body=" + body);
intent.setData(data);
startActivity(intent);  

Explanation can be found here: https://stackoverflow.com/a/3312562/1894684

Leave a Comment