1

I have created an application that gets the location information(latitude,longitude,altitude) and sends email using ACTION_SEND to some gmail account. But i am unable to send auto generated mail to that account. I need to send mail whenever the location changes. But my application is displaying the list of choosers available. Please give me some idea.

Dmytro Zarezenko
  • 10,526
  • 11
  • 62
  • 104
RBS
  • 259
  • 3
  • 9

1 Answers1

1

From you case, you need to send mail when your location has been changed right. So, you've onLocationChanged from you class. From, there you can use this example for sending mail.

For example,

public void onLocationChanged(Location loc)
{
    // Call the GmailSender as per the example
    try {   
        GMailSender sender = new GMailSender("username@gmail.com", "password");
        sender.sendMail("This is Subject",   
                        "This is Body",   
                        "user@gmail.com",   
                        "user@yahoo.com");   
        } catch (Exception e) {   
            Log.e("SendMail", e.getMessage(), e);   
        }
}

So, you can simply send the mail when your location will changed instead of sending mail through Button click.

Community
  • 1
  • 1
Praveenkumar
  • 24,084
  • 23
  • 95
  • 173