How to email highscore through android?

Hi all, I have been trying to find out how to do this but I can only find fragments of information any help would be much appriciated

I currently have a highscore screen where the highscore is displayed as guitext once the game is over/completed.

what I hope to achieve is a button to email score to a friend, so when the player is on the highscore screen they can press SHARE SCORE and it would open up the android email client (gmail?) and read the score from players current score to be included in the email.

Is this possible?

this is my score code

var highScore3dText : TextMesh;
var yourScoreText : TextMesh;

function Start(){

yourScoreText.text = "Your Score: " + PlayerPrefs.GetInt("yourscore").ToString();

highScore3dText.text = "High Score: " + PlayerPrefs.GetInt("highscore").ToString();


I’m thinking a screenshot would be better as it would be easy to just type a score in lol but this looks even more complicated when I have tried to find any information and no tutorials seem to be available

It is theoretically possible but not nice from the user experience point of view.

You see Android devices does not have in built email server, so you can’t send emails from it directly, and using native Email app or GMail app is not a nice solution, as first of all you have no idea how to pass email content/arguments to the 3d party app (it might be even not possible)
and 2ly what if user doesn’t have email? no native email app configured/set up nor Gmail? he wouldn’t be able to share his score? it is not nice :slight_smile:

What you should do is to create server side and send email from server automatically.
technically it will work that way:

  • User on the Android phone click Send score button
  • He type in email address of the friend and click send
  • Android device send request to the server with content of: High Score value and email address of recipient
  • Server capture this request
  • Server(has email server set up) send email to email with content of high score to provided recipient from your admin email like “

however here you have another not nice problem for the user, where would he get email address to type in from? do he have to remember it? it is also not good idea. So you should provide some kind of look Contacts up mechanism or the best solution is to Attache Social Media

why would you send email with high score? you better post it on his wall on Facebook or Google+ or Tweeter or instagram or whatever you like

You can use Application.OpenURL with mailto: scheme.

There is no direct way to send html text. You need to use a plugin.

Cross Platform Native Plugins allows share via

  • E-Mail
  • SMS
  • Facebook
  • Twitter
  • Whats-App

It supports iOS and Android platforms with a unified interface.

You can send HTML text as body here and supports attachments. The plugin is free to use for sharing feature.