1

I have to pass location using XMPP. How can I do it?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Payal Maniyar
  • 4,293
  • 3
  • 25
  • 51
  • Hello you can used stack link to send location to user 1) https://stackoverflow.com/questions/45982752/how-to-send-location-to-other-user-in-xmpp-swift-3-0 – Jay Mehta Sep 02 '17 at 06:29

1 Answers1

3

As I am give you suggestion regarding single chat. as you are prepare xml formate for sending message in XMPP as like bellowed.

NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
[body setStringValue:textvalue];

NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
[message addAttributeWithName:@"type" stringValue:@"chat"];
[message addAttributeWithName:@"to" stringValue:[jid full]];
[message addChild:body];

[[self xmppStream] sendElement:message];

Here add two extra attribute for latitude and longitude as like below.

NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
[body setStringValue:textvalue];

NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
[message addAttributeWithName:@"type" stringValue:@"chat"];
[message addAttributeWithName:@"to" stringValue:[jid full]];
[message addAttributeWithName:@"latitude" stringValue:@"22.2345"];
[message addAttributeWithName:@"longitude" stringValue:@"42.2345"];
[message addChild:body];

[[self xmppStream] sendElement:message];

there won't be any problem in sending message while adding two extra parameter. and at other end while received this message you can fetched latitude and longitude from message and used it as per your requirements.

Hope this help you.

Jatin Patel - JP
  • 3,725
  • 2
  • 21
  • 43