When the location reporting interface is open on an official account, the system asks users who are followers and who have entered a chat to allow the official account to access their location information. Only one prompt is given but users can enter the details page of the official account at a later time to change the location access setting if required.
Obtain User Location
WeChat provides two ways to obtain user locations, which can be set on the Admin Platform:
(1) Users report their location only after entering into a chat with the official account.
(2) The system provides a report once every 5 seconds during a chat.
WeChat implements location reporting by pushing XML packets to the URL entered by the developer. See an example below:
<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>
|ToUserName||Developer's WeChat ID|
|FromUserName||Unique sender ID (an OpenID)|
|CreateTime||Message creation time (Integer)|