I have made a program in which i am fetching device’s current location details and showing in edit text, but now i want to send device’s current location details to other device using SMS, and that other device’s contact number i would like to define in my code: XXXXXXX9,
so please help me to do that how it could be possible for me…..
Answer:
I have written code with the help of Nagaraj436 & Appu, like this:
String phoneNumber = "XXXX9";
String message = editLocation.getText().toString();
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumber, null, message, null, null);
Toast.makeText(getApplicationContext(),
"Message Sent!", Toast.LENGTH_LONG).show();
Write and Call the below method on your button click.
and use the following permission.