如何通过短信发送网址发送我的位置信息? [英] how do i send my location via url in sms?

查看:272
本文介绍了如何通过短信发送网址发送我的位置信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个android项目,所以任何人都可以告诉我如何通过SMS在URL中发送当前位置. 让我解释一下,当手机震动时我想知道什么,然后我的应用程序向选定的联系人发送了一条短信,我想在我的应用程序中添加位置功能,这意味着我想在接收者点击时通过SMS中的URL发送位置在URL上,那么他可以在他的地图中找到发件人的位置吗?

i am making a android project so can anyone tell me how do i send my current location in URL via SMS . Let me explain what i want to know when the mobile got a shake then my app sent a string SMS to selected contact now i want to add location feature in my app mean i want to send the location via URL in SMS ,when the receiver hit on URL then he can the location of sender in his map ?

  private void sendSMS(String ph, String message) {
        SmsManager smsManager = SmsManager.getDefault();
        smsManager.sendTextMessage(ph, null, message, null, null);
        Toast.makeText(getApplicationContext(), "SMS SENT",
                Toast.LENGTH_LONG).show();
    }

推荐答案

我建议您获取设备的当前latitudelongitude.在第二步中,您可以创建一个字符串,它是一个搜索url,其参数如下所示:

I suggest you to get the current latitude and longitude of the device. The in step two you can create a String which is a searching url with those parameters which looks like this

   String message = "http://maps.google.com/?q=" + {latitude} + "," + {longitude}

有关获取当前longitudelatitude的更多信息,请查看

And for the further info to get the current longitude and latitude have a look here

这篇关于如何通过短信发送网址发送我的位置信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆