Get user location


Get the user’s geographical location

1474939940301645.png

The public account that reports the geographical location interface is opened. When the user enters the public account session after following it, A box will pop up asking the user to confirm whether the official account is allowed to use their geographical location. The pop-up box only appears once after following it, and users can perform operations on the official account details page in the future.

After receiving the geographical location report information, the third party only needs to reply with success to indicate receipt. Reply messages to fans are not allowed.

Get the user’s geographical location

After the user agrees to report the geographical location, every time he enters the official account session, the geographical location will be reported when entering. Report the geographical location The location is implemented by pushing an XML data package to the URL filled in by the developer.

Push XML data packet example:

<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[LOCATION]]></Event>
<Latitude>23.137466</Latitude>
<Longitude>113.352425</Longitude>
<Precision>119.385040</Precision>
</xml>

Parameter Description:

ParametersDescription
ToUserNameDeveloperWeChat ID
FromUserNameSender account (an OpenID)
CreateTimeMessage creation time (Integer type)
MsgTypeMessage type, event
EventEvent type, LOCATION
LatitudeGeographical location latitude
LongitudeGeographical location longitude
PrecisionGeolocation accuracy
##