I have made a app that can start a new email intent on a button click, I have tested it on several devices and it appears to work fine except that it crashes on galaxy 2 and galaxy 3. Here is my code checking for internet access then calling the intent.
ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
if((cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isAvailable() && cm.getActiveNetworkInfo().isConnected()))
{
Log.d("Main", "Start Email");
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setClassName("com.google.android.gm","com.google.android.gm.ComposeActivityGmail");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { monkey.getSendTo() });
sendIntent.setData(Uri.parse(monkey.getSendTo()));
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "TFS note");
sendIntent.setType("plain/text");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Sent From TFS\n");
startActivity(sendIntent);
} else{//toast if there is no internet
Toast.makeText(getActivity().getBaseContext(),"No Internet\n access",
Toast.LENGTH_SHORT).show();
}
It looks like to me that on galaxy devices it is not fining the gmail app so it can't start up the intent, so I was wondering how I could go about making a generic intent to open any form of emailing app, or if there is a better way of making it compatible with galaxy devices.