在此代码中,当用户按下按钮时,我手动发送我想要发送当前位置的位置。
{
ActivityCompat.requestPermissions(Home.this,new String[]{Manifest.permission.SEND_SMS},1);
SmsManager smsManager = SmsManager.getDefault();
StringBuffer smsBody = new StringBuffer();
smsBody.append(Name + " Hi, I am in trouble Please help ! My Location Link http://maps.google.com/maps?q=");
smsBody.append("23.251295");//23.251295, 77.5245421//23.249159 //77.528058
smsBody.append(",");
smsBody.append("77.5245421");
smsManager.sendTextMessage(Number, null, smsBody.toString(), null, null);
Toast.makeText(getApplicationContext(), "SMS Sent!", Toast.LENGTH_LONG).show();
}