小智 7
我想这就是你需要的.
public void sendLocationSMS(String phoneNumber, Location currentLocation) {
SmsManager smsManager = SmsManager.getDefault();
StringBuffer smsBody = new StringBuffer();
smsBody.append("http://maps.google.com?q=");
smsBody.append(currentLocation.getLatitude());
smsBody.append(",");
smsBody.append(currentLocation.getLongitude());
smsManager.sendTextMessage(phoneNumber, null, smsBody.toString(), null, null);
}
Run Code Online (Sandbox Code Playgroud)
我会使用地图叠加而不是默认地图.
我开发了一个使用位置功能并在地图中显示的应用程序.在Google Play上看到它.
"Wherez U" https://play.google.com/store/apps/details?id=com.kabhos.android.apps.knowmylocation
小智 5
String uri = "http://maps.google.com/maps?saddr=" + currentLocation.getLatitude()+","+currentLocation.getLongitude();
SmsManager smsManager = SmsManager.getDefault();
StringBuffer smsBody = new StringBuffer();
smsBody.append(Uri.parse(uri)); `
smsManager.sendTextMessage(phonenumber, null, smsBody.toString(), null, null);
Run Code Online (Sandbox Code Playgroud)
你必须将该字符串解析为 uri。这对我有用
归档时间: |
|
查看次数: |
20466 次 |
最近记录: |