Skip to content

Instantly share code, notes, and snippets.

@axeda
Created July 26, 2011 14:30
Show Gist options
  • Select an option

  • Save axeda/1106895 to your computer and use it in GitHub Desktop.

Select an option

Save axeda/1106895 to your computer and use it in GitHub Desktop.
Send a Tweet with Location script
import groovyx.net.http.RESTClient
import static groovyx.net.http.ContentType.*
import com.axeda.drm.sdk.geofence.Geofence
twitter = new RESTClient('http://twitter.com/statuses/')
twitter.auth.basic parameters.twitterUser, parameters.twitterPassword
twitter.client.params.setBooleanParameter 'http.protocol.expect-continue', false
def statusText = "'${parameters.twitterStatus}' for device: ${context.device.serialNumber} on ${new Date()}"
resp = twitter.post(path: 'update.xml',
requestContentType: URLENC,
body: [status: statusText, lat: mobileLocation.lat, long: mobileLocation.lng])
logger.info resp.status
logger.info "Posted update $statusText"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment