共享地图基于位置的 [英] Sharing Map based Location
问题描述
我已经开发了显示在地图上自己的位置的应用程序。我该如何去和别人谁使用我的应用程序分享我当前的位置?是否可以向他们发送通知,让他们知道我现在的位置?
I have developed an application that shows one's location on a map. How do I go about sharing my current location with others who are using my application? Is it possible to send them a notification to let them know my current location?
推荐答案
这是我用来发送的位置是利用 maps.google.com
网站的一种格式,这样的:
A format that I use to send a location is to leverage the maps.google.com
site, like:
"http://maps.google.com/maps?q=" + loc_x + "," + loc_y + "&iwloc=A"
本字符串
可插入一个短信或电子邮件消息。我发现本网站与格式化的URL自动打开集中在给定的坐标映射一些好的信息。一个可能实现的短信可能是:
This String
can be inserted into a SMS or Email message. I found this site with some good info for formating a URL to automatically open a map centered on the given coordinates. A possible implementation for SMS could be:
String message =
"http://maps.google.com/maps?q=" + loc_x + "," + loc_y + "&iwloc=A";
private void sendSMS(String phoneNumber, String message){
SmsManager sms = SmsManager.getDefault();
Log.d(TAG, "Attempting to send an SMS to: " + phoneNumber);
try {
sms.sendTextMessage(phoneNumber, null, message, null, null);
} catch (Exception e) {
Log.e(TAG, "Error sending an SMS to: " + phoneNumber + " :: " + e);
}
}
其中, loc_x
和 loc_y
重present纬度和经度从 LocationManager
实例。
Where loc_x
and loc_y
represent lat and lon from a LocationManager
instance.
这篇关于共享地图基于位置的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!