Send google maps address of an app in message to the mobile phone?

0

I'm creating an app in Android Studio, and I'm having a problem.

The app contains Google Maps where it shows us our location, but what I would really like to do was, that at the push of a button, our location would be sent by SMS to a mobile phone number, is it possible?

    
asked by anonymous 29.07.2015 / 18:19

1 answer

0

You can use the SmsManager API:

btnSendSMS.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
        enviarSMS("+551199999999", "Testando");
    }
});

...

//Enviando a mensagem

private void enviarSMS(String numero, String mensagem) {
    SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage(numero, null, mensagem, null, null);
}

Or you can build the message in the device's default SMS application:

btnSendSMS.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
        enviarSMS("+551199999999", "Testando");
    }
});

...

//Enviando a mensagem

private void enviarSMS(String numero, String mensagem) {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:" + numero));
    intent.putExtra("sms_body", mensagem);
    startActivity(intent);
}
    
29.07.2015 / 23:09