Package org.jivesoftware.smackx.geoloc
Class GeoLocationManager
java.lang.Object
org.jivesoftware.smack.Manager
org.jivesoftware.smackx.geoloc.GeoLocationManager
Entry point for Smacks API for XEP-0080: User Location.
To publish a UserLocation, please use
To stop publishing a UserLocation, please use
To add a
To link a GeoLocation with
An example for illustration is provided inside GeoLocationTest inside the test package.
To publish a UserLocation, please use
publishGeoLocation(GeoLocation)
method. This will publish the node.
To stop publishing a UserLocation, please use
stopPublishingGeolocation()
method. This will send a disable publishing signal.
To add a
PepEventListener
in order to remain updated with other users GeoLocation, use addGeoLocationListener(PepEventListener)
method.
To link a GeoLocation with
Message
, use `message.addExtension(geoLocation)`.
An example for illustration is provided inside GeoLocationTest inside the test package.
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addGeoLocationListener
(PepEventListener<GeoLocation> listener) static GeoLocationManager
getInstanceFor
(XMPPConnection connection) Retrieves aGeoLocationManager
for the specifiedXMPPConnection
, creating one if it doesn't already exist.static boolean
isGeoLocationMessage
(Message message) Returns true if the message contains a GeoLocation extension.void
publishGeoLocation
(GeoLocation geoLocation) Publish the user's geographic location through the Personal Eventing Protocol (PEP).boolean
removeGeoLocationListener
(PepEventListener<GeoLocation> listener) void
sendGeoLocationToJid
(GeoLocation geoLocation, Jid jid) void
Send empty geolocation through the PubSub node.Methods inherited from class org.jivesoftware.smack.Manager
connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
-
Field Details
-
GEOLOCATION_NODE
- See Also:
-
-
Method Details
-
getInstanceFor
Retrieves aGeoLocationManager
for the specifiedXMPPConnection
, creating one if it doesn't already exist.- Parameters:
connection
- The connection the manager is attached to.- Returns:
- The new or existing manager.
-
sendGeoLocationToJid
public void sendGeoLocationToJid(GeoLocation geoLocation, Jid jid) throws InterruptedException, SmackException.NotConnectedException -
isGeoLocationMessage
Returns true if the message contains a GeoLocation extension.- Parameters:
message
- the message to check if contains a GeoLocation extension or not- Returns:
- a boolean indicating whether the message is a GeoLocation message
-
publishGeoLocation
public void publishGeoLocation(GeoLocation geoLocation) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, PubSubException.NotALeafNodeException Publish the user's geographic location through the Personal Eventing Protocol (PEP).- Parameters:
geoLocation
- the geographic location to publish.- Throws:
InterruptedException
- if the calling thread was interrupted.SmackException.NotConnectedException
- if the XMPP connection is not connected.XMPPException.XMPPErrorException
- if there was an XMPP error returned.SmackException.NoResponseException
- if there was no response from the remote entity.PubSubException.NotALeafNodeException
- if a PubSub leaf node operation was attempted on a non-leaf node.
-
stopPublishingGeolocation
public void stopPublishingGeolocation() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, PubSubException.NotALeafNodeExceptionSend empty geolocation through the PubSub node.- Throws:
InterruptedException
- if the calling thread was interrupted.SmackException.NotConnectedException
- if the XMPP connection is not connected.XMPPException.XMPPErrorException
- if there was an XMPP error returned.SmackException.NoResponseException
- if there was no response from the remote entity.PubSubException.NotALeafNodeException
- if a PubSub leaf node operation was attempted on a non-leaf node.
-
addGeoLocationListener
-
removeGeoLocationListener
-