所以这是我的问题。&符号在短信 - 短信发送android
我这是应该发送短信每隔X秒计时器。 而我希望短信成为用户当前的GPS位置。 所以,我想发送一种Google Maps URL,使用我得到的GPS坐标,并为地图添加一些标记,maptype,size ....
要做到这一点,我需要在URL中使用的字符“&”。为了得到类似的东西: http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=400x400&maptype=roadmap
(即:https://developers.google.com/maps/documentation/staticmaps/?csw=1#URL_Parameters)
但是,当我想用这样的URL,在短信我的短信使用“&”。短信从未发送。当我删除包含“&”的每个部分时,它工作正常。
我试图用 “&放大器;”而不是“&”。仍然不起作用。
这里是我的短信管理器发送短信:
smsManager.sendTextMessage(INT, null, "Alert - RED AREA \n TIME : " + current date + " \n Lat: " + latitude + " \n Long: " + longitude + "Link Maps : http://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude +"&zoom=12&size=400x400&maptype=satellite", null, null);
上面的代码,不发送任何消息。 但这一个:
smsManager.sendTextMessage(INT, null, "Alert - RED AREA \n TIME : " + current date + " \n Lat: " + latitude + " \n Long: " + longitude + "Link Maps : http://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude, null, null);
任何想法?
谢谢!
试试这个http://stackoverflow.com/a/3286128/1911784 – OMAK
感谢您的联系!它帮助了我。地址的编码是强制性的。添加一些'&'会破坏网址。 –