Code example for PackageInfo

0
        PackageInfo pi;
		try { 
			pi = pm.getPackageInfo(context.getPackageName(), 0);
		} catch (NameNotFoundException e) {
			Log.v("Feedback", "Unable to get package info!");
			pi = new PackageInfo(); // return a empty package info
		} 
 
		String texts = "Device Information: " + android.os.Build.MODEL + " " +
		   android.os.Build.DEVICE + " SDK " + 
		   android.os.Build.VERSION.SDK + 
		   ", Software version: " + pi.versionName +
		   "\n*** If you don't want to share your device information," + 
		   " you can just delete this text :)\n"; 
		emailIntent.putExtra(Intent.EXTRA_TEXT, texts);
 
		try { 
		    context.startActivity(Intent.createChooser(emailIntent, "Feedback via email..."));
		} catch (android.content.ActivityNotFoundException ex) {
		    Toast.makeText(context, "There are no email clients installed.",
Contextual code suggestions in your IDE  Get Codota for Java