0

I know how to send email from android application and this is my code

Uri uri = Uri.parse("mailto:prayers@e-orthodoxy.net");
    Intent send = new Intent(Intent.ACTION_SENDTO, uri);
    send.putExtra(Intent.EXTRA_SUBJECT, "Review");
    startActivity(Intent.createChooser(send, "Review"));

but how to send

1- device model

2- android version

3- application version

within the subject so they will be wroted automatically

user3328733
  • 7
  • 1
  • 4
  • this link can help you http://stackoverflow.com/questions/1995439/get-android-phone-model-programmatically – Zied R. Feb 23 '14 at 20:40

1 Answers1

0

This is an example, into Intent.EXTRA_TEXT set the device information

Intent msg = new Intent(Intent.ACTION_SEND);
            String[] recipients = { "mailto:prayers@e-orthodoxy.net" };
            String[] carbonCopies = { "" };
            msg.putExtra(Intent.EXTRA_EMAIL, recipients);
            msg.putExtra(Intent.EXTRA_CC, carbonCopies);
            msg.putExtra(Intent.EXTRA_TEXT, getDeviceInformation( getResources().getString(R.string.appversion)));
            msg.putExtra(Intent.EXTRA_SUBJECT, "this is an email");
            msg.setType("message/rfc822");
            startActivity(Intent.createChooser(msg, "Email:"));

this is my method, you can send the appversion from strings.xml:

public static String getDeviceInformation(String appversion){
    String info = "\n\n"+android.os.Build.MODEL+" "+"/"+android.os.Build.VERSION.RELEASE+"/"+ appversion;
    return info;
}

or you can get the app version from your Manifest.xml file

public static String getDeviceInformation(){
PackageManager manager = this.getPackageManager();
PackageInfo infoPackage = manager.getPackageInfo(this.getPackageName(), 0);
String appversion = infoPackage.versionName;
        String info = "\n\n"+android.os.Build.MODEL+" "+"/"+android.os.Build.VERSION.RELEASE+"/"+ appversion;
        return info;
}

to get the android version you will use :

android.os.Build.VERSION.RELEASE

or

android.os.Build.VERSION.SDK_INT

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
  • hey you can use the other method DeviceInformation() and you don't need to send the appversion, it will be read from the manifest.xml, thank you =). – Jorgesys Feb 23 '14 at 21:02